Exception: QaddyClient::Errors::ErrorWithResponse
- Defined in:
- lib/qaddy_client/errors.rb
Direct Known Subclasses
Forbidden, Locked, NotFound, RequestFailed, Timeout, Unauthorized, VerificationRequired
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(message, response) ⇒ ErrorWithResponse
constructor
A new instance of ErrorWithResponse.
Constructor Details
#initialize(message, response) ⇒ ErrorWithResponse
Returns a new instance of ErrorWithResponse.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/qaddy_client/errors.rb', line 10 def initialize(, response) super @response = response @code = response.code @result = response.body begin @result = JSON.parse(@result) rescue # leave non-JSON body as is end end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/qaddy_client/errors.rb', line 7 def code @code end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/qaddy_client/errors.rb', line 6 def response @response end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/qaddy_client/errors.rb', line 8 def result @result end |