Skip to content

Commit

Permalink
Add getShippingMethods
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Morrissey committed Aug 18, 2016
1 parent 71c6d49 commit a0ea16f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Bigcommerce/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,17 @@ public static function getOrderStatuses()
}

/**
* Get collection of product skus
* Enabled shipping methods.
*
* @return array
*/
public static function getShippingMethods()
{
return self::getCollection('/shipping/methods', 'ShippingMethod');
}

/**
* Get collection of skus for all products
*
* @param array $filter
* @return mixed
Expand Down
14 changes: 14 additions & 0 deletions src/Bigcommerce/Api/Resources/ShippingMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Bigcommerce\Api\Resources;

use Bigcommerce\Api\Resource;
use Bigcommerce\Api\Client;

/**
* A shipping method.
*/
class ShippingMethod extends Resource
{

}
12 changes: 12 additions & 0 deletions test/Unit/Api/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,18 @@ public function testUpdatingASkuPutsToTheSkuResource()
Client::updateSku(1, array());
}

public function testGettingShippingMethods()
{
$this->connection->expects($this->once())
->method('get')
->with($this->basePath . '/shipping/methods')
->will($this->returnValue(array((object)array())));

$collection = Client::getShippingMethods();
$this->assertInternalType('array', $collection);
$this->assertContainsOnlyInstancesOf('Bigcommerce\\Api\\Resources\\ShippingMethod', $collection);
}

public function testGettingProductImagesReturnsCollectionOfProductImages()
{
$this->connection->expects($this->once())
Expand Down

0 comments on commit a0ea16f

Please sign in to comment.