Exception: Pin::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Pin::Error
- Defined in:
- lib/pin/error.rb
Instance Attribute Summary collapse
-
#json_body ⇒ Object
Possible Responses.
-
#status ⇒ Object
Possible Responses.
Instance Method Summary collapse
- #details ⇒ Object
- #error ⇒ Object
- #error_description ⇒ Object
-
#initialize(status, json_body) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(status, json_body) ⇒ Error
Returns a new instance of Error.
18 19 20 21 |
# File 'lib/pin/error.rb', line 18 def initialize(status, json_body) @status = status @json_body = JSON.parse(json_body) end |
Instance Attribute Details
#json_body ⇒ Object
Possible Responses
200 - (OK) Successful request 422 - (invalid_resource) One or more parameters were missing or invalid 400 - (card_declined) The card was declined 400 - (insufficient_funds) Bad api_key or not authorized to access a resource. 400 - (suspected_fraud) The resource requested doesn’t exist. 400 - (expired_card) Clever screwed up. 404 - (resource_not_found) No resource was found at this URL. 500 - Server errors
16 17 18 |
# File 'lib/pin/error.rb', line 16 def json_body @json_body end |
#status ⇒ Object
Possible Responses
200 - (OK) Successful request 422 - (invalid_resource) One or more parameters were missing or invalid 400 - (card_declined) The card was declined 400 - (insufficient_funds) Bad api_key or not authorized to access a resource. 400 - (suspected_fraud) The resource requested doesn’t exist. 400 - (expired_card) Clever screwed up. 404 - (resource_not_found) No resource was found at this URL. 500 - Server errors
16 17 18 |
# File 'lib/pin/error.rb', line 16 def status @status end |
Instance Method Details
#details ⇒ Object
31 32 33 |
# File 'lib/pin/error.rb', line 31 def details @json_body end |
#error ⇒ Object
23 24 25 |
# File 'lib/pin/error.rb', line 23 def error @json_body['error'] end |
#error_description ⇒ Object
27 28 29 |
# File 'lib/pin/error.rb', line 27 def error_description @json_body['error_description'] end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/pin/error.rb', line 35 def to_s "HTTP Error #{@status}: #{error}" end |