Exception: GmapsTz::Error
- Inherits:
-
StandardError
- Object
- StandardError
- GmapsTz::Error
- Defined in:
- lib/gmaps_tz/error.rb
Direct Known Subclasses
InvalidRequestError, InvalidResponseBodyError, OverQueryLimitError, RequestDeniedError, UnexpectedResponseError, UnknownError, ZeroResultsError
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri, body) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(uri, body) ⇒ Error
Returns a new instance of Error.
23 24 25 26 |
# File 'lib/gmaps_tz/error.rb', line 23 def initialize(uri, body) @uri = uri @body = body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
21 22 23 |
# File 'lib/gmaps_tz/error.rb', line 21 def body @body end |
#uri ⇒ Object
Returns the value of attribute uri.
21 22 23 |
# File 'lib/gmaps_tz/error.rb', line 21 def uri @uri end |
Class Method Details
.from_json(uri, json) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gmaps_tz/error.rb', line 3 def self.from_json(uri, json) klass = case json["status"] when "INVALID_REQUEST" InvalidRequestError when "OVER_QUERY_LIMIT" OverQueryLimitError when "REQUEST_DENIED" RequestDeniedError when "UNKNOWN_ERROR" UnknownError when "ZERO_RESULTS" ZeroResultsError else UnexpectedResponseError end klass.new(uri, json) end |