-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
McCaulay Hudson
committed
Mar 23, 2020
1 parent
0972961
commit c254662
Showing
9 changed files
with
298 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
namespace McCaulay\Trustpilot\API\BusinessUnit\Product; | ||
|
||
use McCaulay\Trustpilot\API\BusinessUnit\Product\ProductApi; | ||
use McCaulay\Trustpilot\API\Resource; | ||
|
||
class Product extends Resource | ||
{ | ||
/** | ||
* Save the product. | ||
* | ||
* @return mixed | ||
*/ | ||
public function save() | ||
{ | ||
return (new ProductApi())->save([$this->toSaveArray()])[0]; | ||
} | ||
|
||
/** | ||
* Get the parameters to save. | ||
* | ||
* @return array | ||
*/ | ||
private function toSaveArray() | ||
{ | ||
return [ | ||
'sku' => $this->sku, | ||
'title' => $this->title, | ||
'description' => $this->description, | ||
'mpn' => $this->mpn, | ||
'price' => $this->price, | ||
'currency' => $this->currency, | ||
'link' => $this->link, | ||
'imageLink' => $this->imageLink, | ||
'gtin' => $this->gtin, | ||
'brand' => $this->brand, | ||
'googleMerchantCenterProductId' => $this->googleMerchantCenterProductId, | ||
]; | ||
} | ||
} |
Oops, something went wrong.