From 09c7789f0eceb59948422bc6477b9acb59983fd2 Mon Sep 17 00:00:00 2001 From: Stefan Ninic Date: Fri, 22 Mar 2019 14:26:21 +0100 Subject: [PATCH] CustomerGroup --- src/Builders/CustomerGroupBuilder.php | 32 +++++++++++++++++++++++++++ src/Magento.php | 10 +++++++++ src/Models/CustomerGroup.php | 18 +++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 src/Builders/CustomerGroupBuilder.php create mode 100644 src/Models/CustomerGroup.php diff --git a/src/Builders/CustomerGroupBuilder.php b/src/Builders/CustomerGroupBuilder.php new file mode 100644 index 0000000..d9c71e6 --- /dev/null +++ b/src/Builders/CustomerGroupBuilder.php @@ -0,0 +1,32 @@ +parseFilters( $filters ); + + return $this->request->handleWithExceptions( function () use ( $urlFilters ) { + + $response = $this->request->client->get( "{$this->entity}/search{$urlFilters}" ); + $responseData = json_decode( (string) $response->getBody() ); + $items = $this->parseResponse( $responseData ); + + return $items; + } ); + } +} \ No newline at end of file diff --git a/src/Magento.php b/src/Magento.php index 622e2db..23ab234 100644 --- a/src/Magento.php +++ b/src/Magento.php @@ -9,6 +9,7 @@ namespace KgBot\Magento; use KgBot\Magento\Builders\CustomerBuilder; +use KgBot\Magento\Builders\CustomerGroupBuilder; use KgBot\Magento\Builders\OrderBuilder; use KgBot\Magento\Builders\ProductBuilder; use KgBot\Magento\Utils\Request; @@ -65,4 +66,13 @@ public function products() { return new ProductBuilder( $this->request ); } + + /** + * @return \KgBot\Magento\Builders\CustomerGroupBuilder + */ + public function customer_groups() + { + + return new CustomerGroupBuilder( $this->request ); + } } \ No newline at end of file diff --git a/src/Models/CustomerGroup.php b/src/Models/CustomerGroup.php new file mode 100644 index 0000000..696e0db --- /dev/null +++ b/src/Models/CustomerGroup.php @@ -0,0 +1,18 @@ +