Exception: FlightStats::API::ResponseError
- Defined in:
- lib/flightstats/api/errors.rb
Overview
The superclass to all errors that occur when making an API request.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(request, response) ⇒ ResponseError
constructor
A new instance of ResponseError.
- #message ⇒ Object
- #to_s ⇒ Object
Methods inherited from Error
Constructor Details
#initialize(request, response) ⇒ ResponseError
Returns a new instance of ResponseError.
11 12 13 |
# File 'lib/flightstats/api/errors.rb', line 11 def initialize request, response @request, @response = request, response end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
8 9 10 |
# File 'lib/flightstats/api/errors.rb', line 8 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
9 10 11 |
# File 'lib/flightstats/api/errors.rb', line 9 def response @response end |
Instance Method Details
#code ⇒ Object
15 16 17 |
# File 'lib/flightstats/api/errors.rb', line 15 def code response.code.to_i if response end |
#message ⇒ Object
30 31 32 |
# File 'lib/flightstats/api/errors.rb', line 30 def json and json['error'] and json['error']['errorMessage'] end |