Skip to content

Commit a3f816c

Browse files
author
Craig Morrissey
committed
Add ProductGoogleProductSearch resource
1 parent 71c6d49 commit a3f816c

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

src/Bigcommerce/Api/Client.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ private static function mapResource($resource, $object)
384384

385385
$baseResource = __NAMESPACE__ . '\\' . $resource;
386386
$class = (class_exists($baseResource)) ? $baseResource : 'Bigcommerce\\Api\\Resources\\' . $resource;
387-
388387
return new $class($object);
389388
}
390389

@@ -1222,6 +1221,16 @@ public static function getSkusCount()
12221221
return self::getCount('/products/skus/count');
12231222
}
12241223

1224+
/**
1225+
* Returns the googleproductsearch mapping for a product.
1226+
*
1227+
* @return Resources\ProductGoogleProductSearch
1228+
*/
1229+
public static function getGoogleProductSearch($productId)
1230+
{
1231+
return self::getResource('/products/' . $productId . '/googleproductsearch', 'ProductGoogleProductSearch');
1232+
}
1233+
12251234
/**
12261235
* Get a single coupon by given id.
12271236
*
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Bigcommerce\Api\Resources;
4+
5+
use Bigcommerce\Api\Resource;
6+
use Bigcommerce\Api\Client;
7+
8+
/**
9+
* A product review.
10+
*/
11+
class ProductGoogleProductSearch extends Resource
12+
{
13+
14+
}

test/Unit/Api/ClientTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,17 @@ public function testUpdatingASkuPutsToTheSkuResource()
422422
Client::updateSku(1, array());
423423
}
424424

425+
public function testGettingProductGoogleProductSearch()
426+
{
427+
$this->connection->expects($this->once())
428+
->method('get')
429+
->with($this->basePath . '/products/1/googleproductsearch')
430+
->will($this->returnValue((object)array()));
431+
432+
$resource = Client::getGoogleProductSearch(1);
433+
$this->assertInstanceOf('Bigcommerce\\Api\\Resources\\ProductGoogleProductSearch', $resource);
434+
}
435+
425436
public function testGettingProductImagesReturnsCollectionOfProductImages()
426437
{
427438
$this->connection->expects($this->once())

0 commit comments

Comments
 (0)