|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of gpupo/netshoes-sdk |
|
5
|
|
|
* Created by Gilmar Pupo <[email protected]> |
|
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
7
|
|
|
* file that was distributed with this source code. |
|
8
|
|
|
* For more information, see <http://www.g1mr.com/>. |
|
9
|
|
|
*/ |
|
10
|
|
|
namespace Gpupo\NetshoesSdk\Entity\Product\Sku; |
|
11
|
|
|
|
|
12
|
|
|
use Gpupo\CommonSdk\Entity\EntityInterface; |
|
13
|
|
|
use Gpupo\NetshoesSdk\Entity\ManagerAbstract; |
|
14
|
|
|
use Gpupo\NetshoesSdk\Entity\Product\Skus; |
|
15
|
|
|
|
|
16
|
|
|
class Manager extends ManagerAbstract |
|
17
|
|
|
{ |
|
18
|
|
|
protected $entity = 'SkuCollection'; |
|
19
|
|
|
|
|
20
|
|
|
protected $maps = [ |
|
21
|
|
|
'save' => ['POST', '/products/{productId}/skus'], //Create a new sku for a product |
|
22
|
|
|
'findSkuById' => ['GET', '/products/{productId}/skus/{itemId}'], // Get the a sku by product Id and sku Id |
|
23
|
|
|
'update' => ['PUT', '/products/{productId}/skus/{sku}/{itemId}'], //Update a product based on SKU |
|
24
|
|
|
'findById' => ['GET', '/products/{itemId}/skus'], //Get the list of product skus |
|
25
|
|
|
'saveStatus' => ['PUT', '/skus/{sku}/bus/{buId}/status'], //Enable or disable sku for sale |
|
26
|
|
|
'savePriceSchedule' => ['POST', '/skus/{sku}/priceSchedules'], //Save a price schedule |
|
27
|
|
|
'savePrice' => ['PUT', '/skus/{sku}/prices'], //Save a base price |
|
28
|
|
|
'saveStock' => ['PUT', '/skus/{sku}/stocks'], //Update stock quantity by sku |
|
29
|
|
|
]; |
|
30
|
|
|
|
|
31
|
|
|
public function save(EntityInterface $product, $route = 'save') |
|
32
|
|
|
{ |
|
33
|
|
|
return $this->execute($this->factoryMap('save'), $product->toJson()); |
|
34
|
|
|
} |
|
35
|
|
|
} |
|
36
|
|
|
|