Esempio n. 1
0
 /**
  * @param  string                                                   $status
  * @return Doctrine\Common\Collections\Collection                   $collection
  * @throws AntiMattr\Sears\Exception\Connection\ConnectionException
  * @throws AntiMattr\Sears\Exception\Http\BadRequestException
  */
 public function findPurchaseOrdersByStatus($status = 'New')
 {
     $resource = sprintf('/SellerPortal/api/oms/purchaseorder/v4?email=%s&password=%s&status=%s', $this->email, $this->password, $status);
     $request = $this->messageFactory->createRequest('GET', $resource, $this->host);
     $response = $this->messageFactory->createResponse();
     $this->updateHeaders($request);
     $requestString = $request->__toString();
     $this->log($requestString);
     try {
         $this->buzz->send($request, $response);
     } catch (ClientException $e) {
         $subject = $e->getMessage();
         throw new ConnectionException($subject);
     }
     $responseString = $response->__toString();
     $this->log($responseString);
     $collection = $this->objectFactory->getInstance('\\Doctrine\\Common\\Collections\\ArrayCollection');
     $this->responseHandler->bindCollection($response, $collection);
     return $collection;
 }
Esempio n. 2
0
 /**
  * @param  string                                      $status
  * @param  array                                       $headers
  * @return Doctrine\Common\Collections\ArrayCollection $collection
  */
 public function findPurchaseOrdersByStatus($status = 'New')
 {
     $resource = sprintf('/SellerPortal/api/oms/purchaseorder/v4?email=%s&password=%s&status=%s', 'xxxxxx', 'yyyyyy', $status);
     $request = $this->messageFactory->createRequest('GET', $resource, 'http://www.example.com');
     $response = $this->messageFactory->createResponse();
     $response->addHeader('1.0 200 OK');
     if (!empty($this->headers)) {
         $response->addHeaders($this->headers);
     }
     if ('' != $this->content) {
         $response->setContent($this->content);
     }
     $requestString = $request->__toString();
     $responseString = $response->__toString();
     $this->log($requestString);
     $this->log($responseString);
     $collection = $this->objectFactory->getInstance('\\Doctrine\\Common\\Collections\\ArrayCollection');
     $this->responseHandler->bindCollection($response, $collection);
     $this->reset();
     return $collection;
 }