diff --git a/src/Bigcommerce/Api/Client.php b/src/Bigcommerce/Api/Client.php index c50d2c98..75f532bd 100644 --- a/src/Bigcommerce/Api/Client.php +++ b/src/Bigcommerce/Api/Client.php @@ -512,7 +512,11 @@ public static function getOptions($filter = array()) return self::getCollection('/options' . $filter->toQuery(), 'Option'); } - /** create options **/ + /** + * Create Options + * @param $object + * @return hash|bool|mixed + */ public static function createOptions($object) { return self::createResource('/options', $object); @@ -1048,7 +1052,7 @@ public static function updateSku($id, $object) */ public static function getCoupon($id) { - return self::getResource('/coupon/' . $id, 'Coupon'); + return self::getResource('/coupons/' . $id, 'Coupon'); } /** @@ -1107,6 +1111,16 @@ public static function deleteAllCoupons() return self::deleteResource('/coupons'); } + /** + * Return the number of coupons + * + * @return int + */ + public static function getCouponsCount() + { + return self::getCount('/coupons/count'); + } + /** * The request logs with usage history statistics. */ diff --git a/test/Unit/Api/ClientTest.php b/test/Unit/Api/ClientTest.php index 1c9a439a..ed3dc04f 100644 --- a/test/Unit/Api/ClientTest.php +++ b/test/Unit/Api/ClientTest.php @@ -274,7 +274,7 @@ public function testGettingASpecificResourceReturnsACollectionOfThatResource($pa */ public function testGettingTheCountOfACollectionReturnsThatCollectionsCount($path, $fnName, $class) { - if (in_array($path, array('coupons', 'order_statuses', 'products/skus', 'requestlogs'))) { + if (in_array($path, array('order_statuses', 'products/skus', 'requestlogs'))) { $this->markTestSkipped(sprintf('The PHP client does not support getting the count of %s', $path)); } @@ -555,7 +555,7 @@ public function testGettingASpecifiedCouponReturnsThatCoupon() { $this->connection->expects($this->once()) ->method('get') - ->with('/coupon/1', false) + ->with('/coupons/1', false) ->will($this->returnValue(array(array(), array()))); $resource = Client::getCoupon(1);