From d9128fa5d1a7c5af85b85ed0775ea98f4ab30a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB?= Date: Tue, 14 Jul 2020 10:07:01 +0300 Subject: [PATCH] settings method --- lib/RetailCrm/Client/ApiVersion5.php | 1 + lib/RetailCrm/Methods/V5/Settings.php | 44 +++++++++++++++++++ .../Tests/Methods/CommonMethodsTest.php | 18 ++++++++ 3 files changed, 63 insertions(+) create mode 100644 lib/RetailCrm/Methods/V5/Settings.php diff --git a/lib/RetailCrm/Client/ApiVersion5.php b/lib/RetailCrm/Client/ApiVersion5.php index f06155c..952d26f 100644 --- a/lib/RetailCrm/Client/ApiVersion5.php +++ b/lib/RetailCrm/Client/ApiVersion5.php @@ -54,6 +54,7 @@ class ApiVersion5 extends AbstractLoader use V5\Packs; use V5\References; use V5\Segments; + use V5\Settings; use V5\Statistic; use V5\Stores; use V5\Tasks; diff --git a/lib/RetailCrm/Methods/V5/Settings.php b/lib/RetailCrm/Methods/V5/Settings.php new file mode 100644 index 0000000..7c0e5f1 --- /dev/null +++ b/lib/RetailCrm/Methods/V5/Settings.php @@ -0,0 +1,44 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link https://help.retailcrm.ru/Developers/ApiVersion5 + */ + +namespace RetailCrm\Methods\V5; + +/** + * PHP version 5.4 + * + * Settings class + * + * @category RetailCrm + * @package RetailCrm + * @author RetailCrm + * @license https://opensource.org/licenses/MIT MIT License + * @link https://help.retailcrm.ru/Developers/ApiVersion5 + */ +trait Settings +{ + /** + * Get settings + * + * @return \RetailCrm\Response\ApiResponse + */ + public function settings() + { + /* @noinspection PhpUndefinedMethodInspection */ + return $this->client->makeRequest( + '/settings', + "GET", + [] + ); + } +} diff --git a/tests/RetailCrm/Tests/Methods/CommonMethodsTest.php b/tests/RetailCrm/Tests/Methods/CommonMethodsTest.php index b93c39e..f08b954 100755 --- a/tests/RetailCrm/Tests/Methods/CommonMethodsTest.php +++ b/tests/RetailCrm/Tests/Methods/CommonMethodsTest.php @@ -62,4 +62,22 @@ class CommonMethodsTest extends TestCase static::assertTrue($response->isSuccessful()); static::assertGreaterThan(0, count($response['credentials'])); } + + /** + * System settings + * + * @group api_methods + * + * @return void + */ + public function testSettings() + { + $client = static::getApiClient(); + + $response = $client->request->settings(); + + static::assertEquals(200, $response->getStatusCode()); + static::assertTrue($response->isSuccessful()); + static::assertGreaterThan(0, count($response['settings'])); + } }