Example #1
0
 /**
  * @param \Psr\Http\Message\ResponseInterface $response
  * @return \Aikidesk\Api\WWW\Contracts\ResponseInterface
  */
 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('Retry-After'));
     $return->setPlainBody($response->getBody()->getContents());
     $return->setData(json_decode($response->getBody(), true));
     $return->setResponseCode($response->getStatusCode());
     return $return;
 }
Example #2
0
 /**
  * @param array $response
  * @return \Aikidesk\SDK\WWW\Contracts\ResponseInterface
  */
 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;
 }