Class: RDStation::ErrorHandler::ResourceNotFound
- Inherits:
-
Object
- Object
- RDStation::ErrorHandler::ResourceNotFound
- Defined in:
- lib/rdstation/error_handler/resource_not_found.rb
Constant Summary collapse
- ERROR_CODE =
'RESOURCE_NOT_FOUND'.freeze
- EXCEPTION_CLASS =
RDStation::Error::ResourceNotFound
Instance Attribute Summary collapse
-
#api_response ⇒ Object
readonly
Returns the value of attribute api_response.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
-
#initialize(api_response) ⇒ ResourceNotFound
constructor
A new instance of ResourceNotFound.
- #raise_error ⇒ Object
Constructor Details
#initialize(api_response) ⇒ ResourceNotFound
Returns a new instance of ResourceNotFound.
9 10 11 12 |
# File 'lib/rdstation/error_handler/resource_not_found.rb', line 9 def initialize(api_response) @api_response = api_response @error = JSON.parse(api_response.body)['errors'] end |
Instance Attribute Details
#api_response ⇒ Object (readonly)
Returns the value of attribute api_response.
4 5 6 |
# File 'lib/rdstation/error_handler/resource_not_found.rb', line 4 def api_response @api_response end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
4 5 6 |
# File 'lib/rdstation/error_handler/resource_not_found.rb', line 4 def error @error end |
Instance Method Details
#raise_error ⇒ Object
14 15 16 17 |
# File 'lib/rdstation/error_handler/resource_not_found.rb', line 14 def raise_error return unless resource_not_found? raise EXCEPTION_CLASS.new(error['error_message'], api_response) end |