Class: CapitalOnTap::Response
- Inherits:
-
Object
- Object
- CapitalOnTap::Response
- Extended by:
- Forwardable
- Defined in:
- lib/capital_on_tap/response.rb
Instance Method Summary collapse
- #error ⇒ Object
-
#initialize(http_response) ⇒ Response
constructor
A new instance of Response.
- #invalid_token? ⇒ Boolean
- #metadata ⇒ Object
Constructor Details
#initialize(http_response) ⇒ Response
Returns a new instance of Response.
11 12 13 |
# File 'lib/capital_on_tap/response.rb', line 11 def initialize(http_response) @http_response = http_response end |
Instance Method Details
#error ⇒ Object
15 16 17 |
# File 'lib/capital_on_tap/response.rb', line 15 def error @http_response.body&.dig(:errorMessage) || @http_response.body&.dig(:error) end |
#invalid_token? ⇒ Boolean
23 24 25 26 27 28 29 |
# File 'lib/capital_on_tap/response.rb', line 23 def invalid_token? auth_failure = @http_response.headers&.dig('www-authenticate') return false unless auth_failure auth_failure.match?('invalid_token') end |
#metadata ⇒ Object
19 20 21 |
# File 'lib/capital_on_tap/response.rb', line 19 def @http_response.body&.dig(:metaData) end |