From 02d622e9b3b5fdaf2d11fa3a9cd9591ce7b4b599 Mon Sep 17 00:00:00 2001 From: Valentin Ursuleac Date: Wed, 21 Dec 2016 12:44:57 -0500 Subject: [PATCH] get categories --- composer.json | 2 +- src/Provider/MerchantOS.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e336199..b97046e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "ursuleacv/oauth2-lightspeed", "description": "LightSpeed OAuth 2.0 Client Provider for The PHP League OAuth2-Client", "license": "MIT", - "version": "2.0.10", + "version": "2.0.11", "authors": [ { "name": "Valentin Ursuleac", diff --git a/src/Provider/MerchantOS.php b/src/Provider/MerchantOS.php index 1535b26..8e44e9f 100644 --- a/src/Provider/MerchantOS.php +++ b/src/Provider/MerchantOS.php @@ -64,6 +64,23 @@ public function getTags($params = []) return []; } + + /** + * @param $params + * @return array + */ + public function getCategories($params = []) + { + $response = $this->makeAPICall('Account.Category', 'GET', null, $params, null); + + if (isset($response['Category']) && $this->itemsCount($response) == 1) { + return [$response['Category']]; + } elseif (isset($response['Category']) && $this->itemsCount($response) > 1) { + return $response['Category']; + } + + return []; + } /** * @param $itemId