Exception: Giftrocket::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Giftrocket::Error
- Defined in:
- lib/giftrocket/error.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
Constructor Details
#initialize(response) ⇒ Error
Returns a new instance of Error.
4 5 6 7 |
# File 'lib/giftrocket/error.rb', line 4 def initialize(response) @response = response super end |
Instance Method Details
#message ⇒ Object
9 10 11 12 13 |
# File 'lib/giftrocket/error.rb', line 9 def response_json = JSON.parse(@response.body).with_indifferent_access errors = response_json[:errors] "Code: #{@response.code}; Data: #{errors}" end |