Exception: Invoicexpress::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Invoicexpress::Error
- Defined in:
- lib/invoicexpress/error.rb
Overview
Custom error class for rescuing from all Invoicexpress errors
Direct Known Subclasses
BadAddress, InternalServerError, NotFound, Unauthorized, UnprocessableEntity
Instance Attribute Summary collapse
-
#messages ⇒ Object
Returns the value of attribute messages.
Instance Method Summary collapse
-
#initialize(response = nil) ⇒ Error
constructor
A new instance of Error.
- #response_body ⇒ Object
Constructor Details
#initialize(response = nil) ⇒ Error
Returns a new instance of Error.
18 19 20 21 22 23 |
# File 'lib/invoicexpress/error.rb', line 18 def initialize(response=nil) @response = response @messages = [] super() end |
Instance Attribute Details
#messages ⇒ Object
Returns the value of attribute messages.
16 17 18 |
# File 'lib/invoicexpress/error.rb', line 16 def @messages end |
Instance Method Details
#response_body ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/invoicexpress/error.rb', line 25 def response_body @response_body ||= if (body = @response[:body]) && !body.empty? if body.is_a?(String) and body.start_with?("<") Invoicexpress::Models::Errors.parse(body) else body end else nil end end |