public function sendRequest($address, $method = self::METHOD_GET, \stdClass $body = null)
{
$jsonResults = $this->getJsonResponse($address, $method, $body);
// Get first element in array if it's an array response
if (is_array($jsonResults)) {
$jsonResults = $jsonResults[0];
}
// Get error type
if (isset($jsonResults->error)) {
throw $this->getExceptionByType($jsonResults->error->type, $jsonResults->error->description);
}
// Get success object only if available
if (isset($jsonResults->success)) {
$jsonResults = $jsonResults->success;
}
return $jsonResults;
}