Ejemplo n.º 1
0
 /**
  * @param \GuzzleHttp\Message\ResponseInterface $response
  * @return Response
  */
 public function returnResponseObject($response)
 {
     $return = new Response();
     $return->setRateLimit($response->getHeader('X-RateLimit-Limit'));
     $return->setRateRemaining($response->getHeader('X-RateLimit-Remaining'));
     $return->setRateReset($response->getHeader('X-RateLimit-Reset'));
     $return->setData($response->json());
     $return->setResponseCode($response->getStatusCode());
     return $return;
 }
Ejemplo n.º 2
0
 /**
  * @param \Guzzle\Http\Message\ResponseInterface $response
  * @return Response
  */
 public function returnResponseObject($response)
 {
     $return = new Response();
     $rateLimitArray = $response->getHeader('X-RateLimit-Limit')->toArray();
     $rateRemainingArray = $response->getHeader('X-RateLimit-Remaining')->toArray();
     $rateResetArray = $response->getHeader('X-RateLimit-Reset')->toArray();
     $return->setRateLimit($rateLimitArray[0]);
     $return->setRateRemaining($rateRemainingArray[0]);
     $return->setRateReset($rateResetArray[0]);
     if (204 == $response->getStatusCode()) {
         $return->setData("");
     } else {
         $return->setData($response->json());
     }
     $return->setResponseCode($response->getStatusCode());
     return $return;
 }
Ejemplo n.º 3
0
 public function returnResponseObject($response)
 {
     $return = new Response();
     $response_array = $this->objectToArray($response['body']);
     $return->setRateLimit($response['headers']['X-Ratelimit-Limit']);
     $return->setRateRemaining($response['headers']['X-Ratelimit-Remaining']);
     $return->setRateReset($response['headers']['X-Ratelimit-Reset']);
     $return->setData($response_array);
     $return->setResponseCode($response['status']);
     return $return;
 }