code: private function parseResponse($response)
      {
          $response->json = json_decode($response->body);
          if ($response->status < 400) {
              return $response->json->response;
          } else {
              throw new RequestException($response);
          }
      }
docs: Parse a response and return an appropriate result
  
  @param  \stdClass $response the response from the server
  
  @throws RequestException
  @return array  the response data