From 67f32551cc6f5f6ecdfeb14c8ab79ca0688d3059 Mon Sep 17 00:00:00 2001 From: Kuvakin Sergey Date: Mon, 20 Nov 2017 16:26:10 +0300 Subject: [PATCH] refs #13207 add method for getting list of application tasks --- README.md | 3 +++ composer.json | 2 +- lib/Innometrics/Helper.php | 27 ++++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4ad5783..c978c1e 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,6 @@ For more info read [API reference](http://public.innomdc.com/inno-helper/) ### [0.0.8] - 2017-06-26 - Added validation in methods for the Scheduler API + +### [0.0.9] - 2017-11-20 +- Added method getting list of tasks diff --git a/composer.json b/composer.json index b178296..c53e854 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "library", "description": "Innometrics helper", "homepage": "http://www.innometrics.com", - "version": "0.0.8", + "version": "0.0.9", "require": { "php": ">=5.3.2", "illuminate/container": "v5.0.33", diff --git a/lib/Innometrics/Helper.php b/lib/Innometrics/Helper.php index 97df352..2f915cf 100644 --- a/lib/Innometrics/Helper.php +++ b/lib/Innometrics/Helper.php @@ -109,11 +109,18 @@ protected function getSchedulerApiHost () { * @return string */ protected function getSchedulerApiUrl (array $params = array()) { + $optional = ''; + if (isset($params['taskId'])) { + $optional = '/'.$params['taskId']; + } elseif (isset($params['getTasksAsString'])) { + $optional = '/tasks'; + } + return sprintf( '%s/scheduler/%s%s?token=%s', $this->getSchedulerApiHost(), $this->getSchedulerId(), - isset($params['taskId']) ? '/'.$params['taskId'] : '', + $optional, $this->getSchedulerToken() ); } @@ -150,6 +157,24 @@ public function getTasks () { return $body; } + /** + * Get list of application tasks + * @return array + */ + public function getListTasks () { + $url = $this->getSchedulerApiUrl(array( + 'getTasksAsString' => true + )); + $response = $this->request(array( + 'url' => $url + )); + $this->checkErrors($response, 200); + + $body = $response['body']; + + return $body; + } + /** * Add application task * @param array