Skip to content

Commit

Permalink
Merge pull request #17 from ShoppinPal/brand-get-method
Browse files Browse the repository at this point in the history
Brand getter method added
  • Loading branch information
emulgeator authored Dec 10, 2018
2 parents bc3114b + 61c1ccd commit 48fa57f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/ShoppinPal/Vend/Api/V2/Brands.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use ShoppinPal\Vend\DataObject\Entity\V2\Brand;
use ShoppinPal\Vend\DataObject\Entity\V2\CollectionResult;
use ShoppinPal\Vend\Exception\EntityNotFoundException;
use YapepBase\Communication\CurlHttpRequest;

/**
Expand Down Expand Up @@ -46,4 +47,24 @@ public function getCollection(
$result['version']['min'], $result['version']['max'], $brands
);
}

/**
* Returns the brand, that matches this ID.
*
* @param string $brandId ID of the brand.
*
* @return Brand
*
* @throws EntityNotFoundException If the brand is not found.
*/
public function get($brandId)
{
$request = $this->getAuthenticatedRequestForUri('api/2.0/brands/' . urlencode($brandId));

$request->setMethod(CurlHttpRequest::METHOD_GET);

$result = $this->sendRequest($request, 'brand get');

return new Brand($result['data'], Brand::UNKNOWN_PROPERTY_IGNORE, true);
}
}
1 change: 0 additions & 1 deletion src/ShoppinPal/Vend/Api/V2/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public function get($productId)
$result = $this->sendRequest($request, 'product get');

return new Product($result['data'], Product::UNKNOWN_PROPERTY_IGNORE, true);

}

/**
Expand Down

0 comments on commit 48fa57f

Please sign in to comment.