Class: Yelp::Error::ResponseValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/yelp/error.rb

Overview

Validates Yelp API responses. This class shouldn’t be used directly, but should be accessed through the Yelp::Error.check_for_error interface.

See Also:

Instance Method Summary collapse

Instance Method Details

#validate(response) ⇒ Object

If the request is not successful, raise an appropriate Yelp::Error exception with the error text from the request response.

Parameters:

  • response

    from the Yelp API



11
12
13
14
# File 'lib/yelp/error.rb', line 11

def validate(response)
  return if successful_response?(response)
  raise error_from_response(response)
end