Skip to content

Commit

Permalink
Merge pull request #75 from hhxsv5/master
Browse files Browse the repository at this point in the history
Add Service Status
  • Loading branch information
hhxsv5 authored Mar 12, 2020
2 parents 04609e8 + 44b4db6 commit cb92413
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ use KuCoin\SDK\PublicApi\Time;
// Require running in cli mode

go(function () {
$api = new Time(null, new SwooleHttp));
$api = new Time(null, new SwooleHttp);
$timestamp = $api->timestamp();
var_dump($timestamp);
});
Expand Down Expand Up @@ -216,6 +216,7 @@ go(function () {
| API | Authentication | Description |
| -------- | -------- | -------- |
| KuCoin\SDK\PrivateApi\Order::create() | YES | https://docs.kucoin.com/#place-a-new-order |
| KuCoin\SDK\PrivateApi\Order::createMulti() | YES | https://docs.kucoin.com/#place-bulk-orders |
| KuCoin\SDK\PrivateApi\Order::cancel() | YES | https://docs.kucoin.com/#cancel-an-order |
| KuCoin\SDK\PrivateApi\Order::cancelAll() | YES | https://docs.kucoin.com/#cancel-all-orders |
| KuCoin\SDK\PrivateApi\Order::getList() | YES | https://docs.kucoin.com/#list-orders |
Expand Down Expand Up @@ -316,6 +317,15 @@ go(function () {

</details>

<details>
<summary>KuCoin\SDK\PublicApi\ServiceStatus</summary>

| API | Authentication | Description |
| -------- | -------- | -------- |
| KuCoin\SDK\PublicApi\ServiceStatus::getStatus() | NO | https://docs.kucoin.com/#service-status |

</details>

## Run tests
> Modify your API key in `phpunit.xml` first.
Expand Down
27 changes: 27 additions & 0 deletions src/PublicApi/ServiceStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace KuCoin\SDK\PublicApi;

use KuCoin\SDK\Http\Request;
use KuCoin\SDK\KuCoinApi;

/**
* Class ServiceStatus
* @package KuCoin\SDK\PublicApi
* @see https://docs.kucoin.com/#service-status
*/
class ServiceStatus extends KuCoinApi
{
/**
* Get the service status
* @return array
* @throws \KuCoin\SDK\Exceptions\HttpException
* @throws \KuCoin\SDK\Exceptions\BusinessException
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
*/
public function getStatus()
{
$response = $this->call(Request::METHOD_GET, '/api/v1/status');
return $response->getApiData();
}
}
26 changes: 26 additions & 0 deletions tests/ServiceStatusTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace KuCoin\SDK\Tests;

use KuCoin\SDK\PublicApi\ServiceStatus;

class ServiceStatusTest extends TestCase
{
protected $apiClass = ServiceStatus::class;
protected $apiWithAuth = false;

/**
* @dataProvider apiProvider
* @param ServiceStatus $api
* @throws \KuCoin\SDK\Exceptions\BusinessException
* @throws \KuCoin\SDK\Exceptions\HttpException
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
*/
public function testGetStatus(ServiceStatus $api)
{
$status = $api->getStatus();
$this->assertInternalType('array', $status);
$this->assertArrayHasKey('status', $status);
$this->assertArrayHasKey('msg', $status);
}
}

0 comments on commit cb92413

Please sign in to comment.