Example #1
0
 public function send(RequestInterface $request)
 {
     $httpClient = new Client(array('base_url' => array($this->getBaseUrl(), array('version' => $this->getApiVersion()))));
     $options = array('exceptions' => false, 'headers' => $this->_getHeaders());
     if ($request->isBodyEmpty() == false) {
         $options['json'] = $request->getBody();
     }
     $httpRequest = $httpClient->createRequest($request->getRequestMethod(), $request->getEndpoint(), $options);
     $httpResponse = $httpClient->send($httpRequest);
     if ($this->isSuccessHttpStatus($httpResponse) !== true) {
         $this->exceptionHandler($httpResponse);
     }
     return new Response($httpResponse);
 }