Exception: PurpleAirApi::V1::BaseError
- Inherits:
-
StandardError
- Object
- StandardError
- PurpleAirApi::V1::BaseError
- Defined in:
- lib/purple_air_api/V1/errors.rb
Overview
A custom error class for rescuing from all PurpleAir API errors
Direct Known Subclasses
ApiError, ApiKeyError, MissingJsonPayloadError, NotFoundError, ServerError
Instance Attribute Summary collapse
-
#error_type ⇒ Object
readonly
Returns the value of attribute error_type.
-
#response_object ⇒ Object
readonly
Returns the value of attribute response_object.
Instance Method Summary collapse
-
#initialize(message, error_type, response_object) ⇒ BaseError
constructor
Initialize the error object with error_type and the Faraday response object.
Constructor Details
#initialize(message, error_type, response_object) ⇒ BaseError
Initialize the error object with error_type and the Faraday response object. PurpleAir returns a human friendly error message and type which is added here. You can also reference the response to view the raw response from PurpleAir.
16 17 18 19 20 |
# File 'lib/purple_air_api/V1/errors.rb', line 16 def initialize(, error_type, response_object) super() @error_type = error_type @response_object = response_object end |
Instance Attribute Details
#error_type ⇒ Object (readonly)
Returns the value of attribute error_type.
7 8 9 |
# File 'lib/purple_air_api/V1/errors.rb', line 7 def error_type @error_type end |
#response_object ⇒ Object (readonly)
Returns the value of attribute response_object.
7 8 9 |
# File 'lib/purple_air_api/V1/errors.rb', line 7 def response_object @response_object end |