Skip to content

Commit 0249246

Browse files
committed
Initial version of Queue-it module
0 parents  commit 0249246

8 files changed

+262
-0
lines changed

README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Queue-it
2+
========
3+
4+
Queue-it is an online queue system designed to manage website overload during extreme end-user peaks. It offers an API for programmatic access to configuring and controlling the queue.
5+
6+
About module
7+
============
8+
9+
This module is unofficial implementation of [Queue-it Framework](https://queue-it.com/) for Drupal CMS. You need to have existing Queue-it account in order to use it.
10+
11+
Authentication
12+
==============
13+
14+
In order to authenticate and authorize the `Api-Key`, HTTP header must be supplied in the REST request. The key can be found in the [GO Queue-it Platform](https://go.queue-it.net/account/security).
15+
16+
This API Key should be specified in the settings page of the module at `admin/config/services/queueit`.
17+
18+
Dependencies
19+
============
20+
21+
The module depends on [Known User Implementation for PHP](https://github.com/queueit/KnownUser.V3.PHP) hosted at GitHub repository.
22+
23+
With composer, setting up things is fairly easy.
24+
25+
1. Download and install the [Composer Manager module](https://drupal.org/project/composer_manager).
26+
27+
2. Run the drush command: `drush composer-manager install`.
28+
29+
If you are already using `composer_manager` with other modules, simply run:
30+
"drush composer-manager update"
31+
This should set up all of your dependencies and all of the libraries necessary
32+
to run behat tests.
33+
34+
To check if the library has been installed, as admin visit /admin/config/system/composer-manager page.
35+
36+
By default, `composer_manager` will place all of the libraries at /sites/all/vendor.
37+
Inside of the vendor directory there is a bin directory and inside of it we can
38+
find the behat executable.
39+
40+
Dependencies
41+
============
42+
43+
Notes
44+
=====
45+
46+
- Queue-it Security Documentation can be found at: <http://securitydoc-assets.queue-it.net>.
47+
- The latest version and API (2) documentation can be found at: <https://api2.queue-it.net/>.
48+
- Older versions [API1](http://api.queue-it.net) has been deprecated now.
49+
- The service will accept both XML and JSON formatted data by setting the `Content-Type` HTTP header.
50+
- Source code and binaries are available at [Github](https://github.com/queueit).
51+
- For support of Queue-it Implementation, please contact Queue-itsupport at <[email protected]>.

composer.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "queueit/KnownUser.V3.PHP",
3+
"type": "library",
4+
"description": "The Queue-it Security Framework is used to ensure that end users cannot bypass the queue by adding a server-side integration to your server.",
5+
"homepage": "https://drupal.org/project/coder",
6+
"support": {
7+
"issues": "https://github.com/queueit/KnownUser.V3.PHP/issues",
8+
"source": "https://github.com/queueit/KnownUser.V3.PHP"
9+
},
10+
"keywords": ["Queue-it", "framework"],
11+
"license": "LGPL-3.0+",
12+
"require": {
13+
"queueit/KnownUser.V3.PHP": "dev-master",
14+
"php": ">=5.2.0"
15+
},
16+
"repositories": [
17+
{
18+
"type": "package",
19+
"package": {
20+
"name": "queueit/KnownUser.V3.PHP",
21+
"version": "dev-master",
22+
"source": {
23+
"type": "git",
24+
"url": "https://github.com/queueit/KnownUser.V3.PHP.git",
25+
"reference": "master"
26+
}
27+
}
28+
}
29+
]
30+
}

queueit.admin.inc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Configuration of the Queue-it module.
6+
*/
7+
8+
/**
9+
* Form builder.
10+
*/
11+
function queueit_settings_form($form, &$form_state) {
12+
$form['queueit_api_key'] = array(
13+
'#type' => 'textfield',
14+
'#title' => t('API Key'),
15+
'#description' => t('Specify the Api-key which can be supplied through the query string parameter. The key can be found in the GO Queue-it Platform.'),
16+
'#default_value' => variable_get('queueit_api_key'),
17+
'#required' => TRUE,
18+
);
19+
20+
return system_settings_form($form);
21+
}

queueit.api.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Hooks provided by the Queue-it module.
6+
*/
7+
8+
/**
9+
* @addtogroup hooks
10+
* @{
11+
*/

queueit.info

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name = Queue-it
2+
description = Queue-it offers an API for programmatic access to configuring and controlling the queue.
3+
version = VERSION
4+
core = 7.x
5+
files[] = tests/queueit.test
6+
configure = admin/config/services/queueit
7+
dependencies[] = composer_manager

queueit.install

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Module's installation file.
6+
*/
7+
8+
/**
9+
* Implements hook_requirements().
10+
*/
11+
function queueit_requirements($phase) {
12+
$requirements = array();
13+
14+
if ($phase == 'runtime') {
15+
$t = get_t();
16+
$known_user_lib = drupal_get_library('queueit', 'queueit/KnownUser');
17+
$exists = $known_user_lib;
18+
$requirements['queueit'] = array(
19+
'title' => $t('KnownUser.V3.PHP'),
20+
'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
21+
'value' => t('%lib library %state.',
22+
['%lib' => 'KnownUser.V3.PHP',
23+
'%state' => $exists ? 'installed' : 'not installed']),
24+
);
25+
}
26+
27+
return $requirements;
28+
}
29+

queueit.module

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* TODO: Enter file description here.
6+
*/
7+
8+
/**
9+
* Implements hook_help().
10+
*/
11+
function queueit_help($path, $arg) {
12+
switch ($path) {
13+
// Main module help for the block module
14+
case 'admin/help#block':
15+
return '<p>' . t('Blocks are boxes of content rendered into an area, or region, of a web page. The default theme Bartik, for example, implements the regions "Sidebar first", "Sidebar second", "Featured", "Content", "Header", "Footer", etc., and a block may appear in any one of these areas. The <a href="@blocks">blocks administration page</a> provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions.', array('@blocks' => url('admin/structure/block'))) . '</p>';
16+
17+
// Help for another path in the block module
18+
case 'admin/structure/block':
19+
return '<p>' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page.') . '</p>';
20+
}
21+
}
22+
23+
/**
24+
* Implements hook_menu().
25+
*/
26+
function queueit_menu() {
27+
$items = array();
28+
$items['admin/config/services/queueit'] = array(
29+
'title' => 'Queue-it settings',
30+
'description' => 'Configure settings for Queue-it.',
31+
'page callback' => 'drupal_get_form',
32+
'page arguments' => array('queueit_settings_form'),
33+
'access arguments' => array('administer queueit'),
34+
'file' => 'queueit.admin.inc',
35+
);
36+
37+
return $items;
38+
}
39+
40+
/**
41+
* Implements hook_library().
42+
*/
43+
function queueit_library() {
44+
// Register libraries available in the external directory.
45+
$path = libraries_get_path('composer') . '/queueit/KnownUser.V3.PHP';
46+
$libraries['queueit/KnownUser'] = array(
47+
'title' => 'KnownUser.V3.PHP',
48+
'version' => '3',
49+
);
50+
return $libraries;
51+
}
52+
53+
/**
54+
* Implements hook_permission().
55+
*/
56+
function queueit_permission() {
57+
$permissions = array();
58+
$permissions['administer'] = array(
59+
'title' => t('TODO: enter permission title'),
60+
'description' => t('TODO: enter permission description'),
61+
);
62+
$permissions['queueit'] = array(
63+
'title' => t('TODO: enter permission title'),
64+
'description' => t('TODO: enter permission description'),
65+
);
66+
$permissions['administer queueit'] = array(
67+
'title' => t('TODO: enter permission title'),
68+
'description' => t('TODO: enter permission description'),
69+
);
70+
71+
return $permissions;
72+
}

tests/queueit.test

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Contains tests for the Queue-it module.
6+
*/
7+
8+
/**
9+
* Test case.
10+
*/
11+
class QueueitTestCase extends DrupalWebTestCase {
12+
13+
/**
14+
* Implements getInfo().
15+
*/
16+
public static function getInfo() {
17+
return array(
18+
'name' => t('Queue-it tests'),
19+
'description' => t('TODO: write me.'),
20+
'group' => t('Queue-it'),
21+
);
22+
}
23+
24+
/**
25+
* Implements setUp().
26+
*/
27+
function setUp() {
28+
// Call the parent with an array of modules to enable for the test.
29+
parent::setUp(array('queueit'));
30+
31+
// TODO: perform additional setup tasks here if required.
32+
}
33+
34+
/**
35+
* Test the module's functionality.
36+
*/
37+
function testTodoChangeThisName() {
38+
// TODO: write test!
39+
}
40+
41+
}

0 commit comments

Comments
 (0)