summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-03-01 20:25:46 -0500
committerFrederic Guillot <fred@kanboard.net>2015-03-01 20:25:46 -0500
commit23f8f2c576271a9007b5da0a4d0ba144ad66086d (patch)
tree5058c2167540389b583bd87dcd9b9992dc399604
parent052b14d48290405c8b3684e872f9c15858745bb2 (diff)
Add api procedure to get the application version
-rw-r--r--docs/api-json-rpc.markdown26
-rw-r--r--jsonrpc.php4
-rw-r--r--tests/functionals/ApiTest.php10
3 files changed, 37 insertions, 3 deletions
diff --git a/docs/api-json-rpc.markdown b/docs/api-json-rpc.markdown
index 0440da0c..1075de56 100644
--- a/docs/api-json-rpc.markdown
+++ b/docs/api-json-rpc.markdown
@@ -144,6 +144,32 @@ Array
Procedures
----------
+### getVersion
+
+- Purpose: **Get the application version**
+- Parameters: none
+- Result: **version** (Example: 1.0.12, master)
+
+Request example:
+
+```json
+{
+ "jsonrpc": "2.0",
+ "method": "getVersion",
+ "id": 1661138292
+}
+```
+
+Response example:
+
+```json
+{
+ "jsonrpc": "2.0",
+ "id": 1661138292,
+ "result": "1.0.13"
+}
+```
+
### getTimezone
- Purpose: **Get the application timezone**
diff --git a/jsonrpc.php b/jsonrpc.php
index a2106010..66421daf 100644
--- a/jsonrpc.php
+++ b/jsonrpc.php
@@ -418,6 +418,10 @@ $server->register('getTimezone', function() use ($container) {
return $container['config']->get('application_timezone');
});
+$server->register('getVersion', function() use ($container) {
+ return APP_VERSION;
+});
+
/**
* Parse incoming requests
*/
diff --git a/tests/functionals/ApiTest.php b/tests/functionals/ApiTest.php
index f778d1ca..9fdfd1ba 100644
--- a/tests/functionals/ApiTest.php
+++ b/tests/functionals/ApiTest.php
@@ -39,7 +39,7 @@ class Api extends PHPUnit_Framework_TestCase
{
$this->client = new JsonRPC\Client(API_URL);
$this->client->authentication('jsonrpc', API_KEY);
- //$this->client->debug = true;
+ // $this->client->debug = true;
}
private function getTaskId()
@@ -53,8 +53,12 @@ class Api extends PHPUnit_Framework_TestCase
public function testGetTimezone()
{
- $timezone = $this->client->getTimezone();
- $this->assertEquals('Europe/Paris', $timezone);
+ $this->assertEquals('Europe/Paris', $this->client->getTimezone());
+ }
+
+ public function testGetVersion()
+ {
+ $this->assertEquals('master', $this->client->getVersion());
}
public function testRemoveAll()