Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Add product edit endpoint #58

Merged
merged 2 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Api/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,16 @@ public function show($sku)
{
return $this->get('/products/'.$sku);
}

/**
* Edit product.
*
* @param string $sku
* @param array $body
* @return array
*/
public function edit($sku, $body = [])
{
return $this->put('/products/'.$sku, $body);
}
}
11 changes: 11 additions & 0 deletions tests/Api/ProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ public function test_can_call_magento_api_products_show()

$this->assertTrue($api->ok());
}

public function test_can_edit_product()
{
Http::fake([
'*rest/all/V1/products/foo' => Http::response([], 200),
]);

$api = MagentoFacade::api('products')->edit('foo', []);

$this->assertTrue($api->ok());
}
}