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