Method: CoreLibrary::ResponseHandler#validate

Defined in:
lib/apimatic-core/response_handler.rb

#validate(response, global_errors) ⇒ Object

Validates the response provided and throws an error against the configured status code.

Parameters:

  • response (HttpResponse)

    The received response.

  • global_errors (Hash)

    Global errors hash.

Raises:

  • (ApiException)

    Throws the exception when the response contains errors.



182
183
184
185
186
187
188
# File 'lib/apimatic-core/response_handler.rb', line 182

def validate(response, global_errors)
  return unless response.status_code < 200 || response.status_code > 299

  validate_against_error_cases(response, @local_errors)

  validate_against_error_cases(response, global_errors)
end