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'])); + } }