Class: RDStation::ErrorHandler::InvalidCredentials
- Inherits:
-
Object
- Object
- RDStation::ErrorHandler::InvalidCredentials
- Defined in:
- lib/rdstation/error_handler/invalid_credentials.rb
Constant Summary collapse
- ERROR_CODE =
'ACCESS_DENIED'.freeze
- EXCEPTION_CLASS =
RDStation::Error::InvalidCredentials
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) ⇒ InvalidCredentials
constructor
A new instance of InvalidCredentials.
- #raise_error ⇒ Object
Constructor Details
#initialize(api_response) ⇒ InvalidCredentials
Returns a new instance of InvalidCredentials.
9 10 11 12 |
# File 'lib/rdstation/error_handler/invalid_credentials.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/invalid_credentials.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/invalid_credentials.rb', line 4 def error @error end |
Instance Method Details
#raise_error ⇒ Object
14 15 16 17 |
# File 'lib/rdstation/error_handler/invalid_credentials.rb', line 14 def raise_error return unless credentials_errors? raise EXCEPTION_CLASS.new(error['error_message'], api_response) end |