-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from hhxsv5/master
Add Service Status
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |