lib/gurunavi/client.rb
# Helper method to return errors or desired response data as appropriate.
#
# Added just for convenience to avoid having to traverse farther down the response just to get to returned data.
Helper method to return errors or desired response data as appropriate.
Added just for convenience to avoid having to traverse farther down the response just to get to returned data.
Helper method to return errors or desired response data as appropriate . Added just for convenience to avoid having to traverse farther down the response just to get to returned data .
def return_error_or_body(response, response_body)
      error_status = nil
      error_status = response.body["error"] if response.body["error"]
      error_status = response.body["gnavi"]["error"] if response.body["gnavi"] && response.body["gnavi"]["error"]
      if error_status
        raise Gurunavi::APIErrorFactory.call_api_errors(error_status.code, error_status.message)
      end
      response_body
    end
def return_error_or_body ( response , response_body ) error_status = nil error_status = response . body [ "error" ] if response . body [ "error" ] error_status = response . body [ "gnavi" ] [ "error" ] if response . body [ "gnavi" ] && response . body [ "gnavi" ] [ "error" ] if error_status raise Gurunavi :: APIErrorFactory . call_api_errors ( error_status . code , error_status . message ) end response_body end
Helper method to return errors or desired response data as appropriate.
Helper method to return errors or desired response data as appropriate .
response
<not_specific>
response_body
<not_specific>