Skip to content

Commit

Permalink
Merge branch 'trunk'
Browse files Browse the repository at this point in the history
  • Loading branch information
thealien committed Jun 26, 2017
2 parents 563e571 + f6d9193 commit e5cce2d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ For more info read [API reference](http://public.innomdc.com/inno-helper/)

### [0.0.7] - 2017-06-13
- Added delay parameter for the Scheduler API

### [0.0.8] - 2017-06-26
- Added validation in methods 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.7",
"version": "0.0.8",
"require": {
"php": ">=5.3.2",
"illuminate/container": "v5.0.33",
Expand Down
13 changes: 12 additions & 1 deletion lib/Innometrics/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,14 @@ public function getTasks () {
* @return bool
*/
public function addTask ($params) {
if (isset($params['timestamp']) && isset($params['delay'])) {
$timestampExists = isset($params['timestamp']);
$delayExists = isset($params['delay']);

if (!$timestampExists && !$delayExists) {
throw new \ErrorException('Either use timestamp or delay');
}

if ($timestampExists && $delayExists) {
throw new \ErrorException('You should use only one field: timestamp or delay');
}

Expand All @@ -194,6 +201,10 @@ public function addTask ($params) {
* @return bool
*/
public function deleteTask ($params) {
if (!isset($params['taskId'])) {
throw new \ErrorException('Parameter "taskId" required');
}

$url = $this->getSchedulerApiUrl($params);
$response = $this->request(array(
'url' => $url,
Expand Down

0 comments on commit e5cce2d

Please sign in to comment.