/**
  * @param CustomCollection $collection
  *
  * @return CustomCollection
  */
 public function export(CustomCollection $collection)
 {
     if (null !== $collection->getId()) {
         $request = new PutJson($this->updateUrl($collection), new CustomCollectionWrapper($collection), $this->serializer);
     } else {
         $request = new PostJson($this->exportUrl(), new CustomCollectionWrapper($collection), $this->serializer);
     }
     /** @var CustomCollectionWrapper $collectionWrapper */
     $collectionWrapper = $request->makeRequest();
     return $collectionWrapper->getCustomCollection();
 }
Exemplo n.º 2
0
 /**
  * @param Product $product
  *
  * @return Product
  */
 public function export(Product $product)
 {
     if (null !== $product->getId()) {
         $request = new PutJson($this->updateUrl($product), new ProductWrapper($product), $this->serializer);
     } else {
         $request = new PostJson($this->exportUrl(), new ProductWrapper($product), $this->serializer);
     }
     /** @var ProductWrapper $productWrapper */
     $productWrapper = $request->makeRequest();
     return $productWrapper->getProduct();
 }
Exemplo n.º 3
0
 /**
  * @param Collect $collect
  *
  * @return Collect
  */
 public function export(Collect $collect)
 {
     if (null !== $collect->getId()) {
         throw new \ErrorException('You can not update a Collect object');
     } else {
         $request = new PostJson($this->exportUrl(), new CollectWrapper($collect), $this->serializer);
     }
     /** @var CollectWrapper $collectWrapper */
     $collectWrapper = $request->makeRequest();
     return $collectWrapper->getCollect();
 }