From 4614549f0b756bfd9d7eee06d7ad0574a21f6358 Mon Sep 17 00:00:00 2001 From: jz Date: Wed, 8 Jul 2015 15:20:35 -0500 Subject: [PATCH 1/3] Removed the options() method from Sku class as the 'options' property on a Sku object is an array of option objects, it is not a reference to a separate resource as this method expects. --- src/Bigcommerce/Api/Resources/Sku.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Bigcommerce/Api/Resources/Sku.php b/src/Bigcommerce/Api/Resources/Sku.php index 58dbdecb..db20f176 100644 --- a/src/Bigcommerce/Api/Resources/Sku.php +++ b/src/Bigcommerce/Api/Resources/Sku.php @@ -19,17 +19,6 @@ class Sku extends Resource 'product_id', ); - public function options() - { - $options = Client::getCollection($this->fields->options->resource, 'SkuOption'); - - foreach ($options as $option) { - $option->product_id = $this->product_id; - } - - return $options; - } - public function create() { return Client::createResource('/products/' . $this->product_id . '/skus', $this->getCreateFields()); From 8b0ee6e48f034fda7bc6d6e6341b008deceaa95b Mon Sep 17 00:00:00 2001 From: jz Date: Wed, 8 Jul 2015 15:51:08 -0500 Subject: [PATCH 2/3] Removed 'shipping_methods' from the ignore fields and added 'billing_address' and 'shipping_address' - this makes the PHP library match the API requirements --- src/Bigcommerce/Api/Resources/Shipment.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Bigcommerce/Api/Resources/Shipment.php b/src/Bigcommerce/Api/Resources/Shipment.php index 3ba233f2..1b5e0bd6 100644 --- a/src/Bigcommerce/Api/Resources/Shipment.php +++ b/src/Bigcommerce/Api/Resources/Shipment.php @@ -12,7 +12,8 @@ class Shipment extends Resource 'order_id', 'date_created', 'customer_id', - 'shipping_method', + 'billing_address', + 'shipping_address' ); protected $ignoreOnUpdate = array( @@ -20,8 +21,9 @@ class Shipment extends Resource 'order_id', 'date_created', 'customer_id', - 'shipping_method', 'items', + 'billing_address', + 'shipping_address' ); public function create() From a696b1e233935f6b0acb72876994adef36b07f8f Mon Sep 17 00:00:00 2001 From: jz Date: Wed, 8 Jul 2015 20:41:22 -0500 Subject: [PATCH 3/3] Removed the test of the options() method from SkuTest.php. Deleted SkuOption.php and SkuOptionTest.php as these don't match with API v2 schema. --- src/Bigcommerce/Api/Resources/SkuOption.php | 31 --------------------- test/Unit/Api/Resources/SkuOptionTest.php | 28 ------------------- test/Unit/Api/Resources/SkuTest.php | 20 ------------- 3 files changed, 79 deletions(-) delete mode 100644 src/Bigcommerce/Api/Resources/SkuOption.php delete mode 100644 test/Unit/Api/Resources/SkuOptionTest.php diff --git a/src/Bigcommerce/Api/Resources/SkuOption.php b/src/Bigcommerce/Api/Resources/SkuOption.php deleted file mode 100644 index 88ab7524..00000000 --- a/src/Bigcommerce/Api/Resources/SkuOption.php +++ /dev/null @@ -1,31 +0,0 @@ -fields->product_id . '/skus/' . $this->fields->sku_id . '/options', $this->getCreateFields()); - } - - public function update() - { - Client::updateResource('/products/' . $this->fields->product_id . '/skus/' . $this->fields->sku_id . '/options/' . $this->id, $this->getUpdateFields()); - } -} diff --git a/test/Unit/Api/Resources/SkuOptionTest.php b/test/Unit/Api/Resources/SkuOptionTest.php deleted file mode 100644 index 03e2bfa8..00000000 --- a/test/Unit/Api/Resources/SkuOptionTest.php +++ /dev/null @@ -1,28 +0,0 @@ - 1, 'sku_id' => 1, 'product_id' => 1)); - $this->connection->expects($this->once()) - ->method('post') - ->with($this->basePath . '/products/1/skus/1/options', (object)array('sku_id' => 1, 'product_id' => 1)); - - $skuoption->create(); - } - - public function testUpdatePassesThroughToConnection() - { - $skuoption = new SkuOption((object)array('id' => 1, 'sku_id' => 1, 'product_id' => 1)); - $this->connection->expects($this->once()) - ->method('put') - ->with($this->basePath . '/products/1/skus/1/options/1', (object)array('product_id' => 1)); - - $skuoption->update(); - } -} diff --git a/test/Unit/Api/Resources/SkuTest.php b/test/Unit/Api/Resources/SkuTest.php index 924ba9e3..8bd230a2 100644 --- a/test/Unit/Api/Resources/SkuTest.php +++ b/test/Unit/Api/Resources/SkuTest.php @@ -25,24 +25,4 @@ public function testUpdatePassesThroughToConnection() $sku->update(); } - - public function testOptionsPassesThroughToConnection() - { - $sku = new Sku((object)array( - 'product_id' => 1, - 'options' => (object)array( - 'resource' => '/products/1/skus/1/options' - ) - )); - $this->connection->expects($this->once()) - ->method('get') - ->with($this->basePath . '/products/1/skus/1/options') - ->will($this->returnValue(array(array(), array()))); - - $collection = $sku->options; - $this->assertInternalType('array', $collection); - foreach ($collection as $condition) { - $this->assertInstanceOf('Bigcommerce\\Api\\Resources\\SkuOption', $condition); - } - } }