Skip to content

Commit

Permalink
refs #11913
Browse files Browse the repository at this point in the history
  • Loading branch information
lafin committed Jun 13, 2017
1 parent 6f2c7e8 commit c251918
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ For more info read [API reference](http://public.innomdc.com/inno-helper/)

### [0.0.6] - 2017-05-22
- Added support Scheduler API

### [0.0.7] - 2017-06-13
- Added delay parameter for the Scheduler API
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "library",
"description": "Innometrics helper",
"homepage": "http://www.innometrics.com",
"version": "0.0.6",
"version": "0.0.7",
"require": {
"php": ">=5.3.2",
"illuminate/container": "v5.0.33",
Expand Down
50 changes: 22 additions & 28 deletions lib/Innometrics/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,25 @@ public function getTasks () {

/**
* Add application task
* @param {Object} params
* @example
* {
* "endpoint": "string", // required
* "method": "string", // required
* "headers": {},
* "id": "string",
* "payload": "string",
* "timestamp": 0
* }
* @param array
*
* [
* "endpoint" => "string", // required
* "method" => "string", // required
* "headers" => [],
* "id" => "string",
* "payload" => "string",
* "timestamp" => 0,
* "delay" => 0
* ]
*
* @return bool
*/
public function addTask ($params) {
if (isset($params['timestamp']) && isset($params['delay'])) {
throw new \ErrorException('You should use only one field: timestamp or delay');
}

$url = $this->getSchedulerApiUrl();
$response = $this->request(array(
'url' => $url,
Expand All @@ -179,11 +185,12 @@ public function addTask ($params) {

/**
* Delete application task
* @param {Object} params
* @example
* {
* "taskId": "string", // required
* }
* @param array
*
* [
* "taskId" => "string", // required
* ]
*
* @return bool
*/
public function deleteTask ($params) {
Expand Down Expand Up @@ -360,13 +367,7 @@ protected static function request ($params) {
}
break;

// case 'get':
default:
/* Not used, disabled for code coverage
if (!empty($params['qs'])) {
$params['url'] .= '?' . http_build_query($params['qs']);
}
*/
break;
}

Expand All @@ -375,13 +376,6 @@ protected static function request ($params) {
'Accept: application/json'
);

/* Not used, disabled for code coverage
if (isset($params['headers']) && !empty($params['headers'])) {
$headers = array_merge($headers, $params['headers']);
$headers = array_unique($headers);
}
*/

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_URL, $params['url']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
Expand Down

0 comments on commit c251918

Please sign in to comment.