Exception: Footrest::HttpError::ErrorBase
- Inherits:
-
StandardError
- Object
- StandardError
- Footrest::HttpError::ErrorBase
- Defined in:
- lib/footrest/http_error.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(response = nil) ⇒ ErrorBase
constructor
A new instance of ErrorBase.
Constructor Details
#initialize(response = nil) ⇒ ErrorBase
Returns a new instance of ErrorBase.
10 11 12 13 14 15 16 17 |
# File 'lib/footrest/http_error.rb', line 10 def initialize(response=nil) @response = response @status = @response[:status] @body = @response[:body] @method = @response[:method] super("HTTP ERROR: #{@status} #{errors}") end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/footrest/http_error.rb', line 8 def body @body end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
8 9 10 |
# File 'lib/footrest/http_error.rb', line 8 def method @method end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/footrest/http_error.rb', line 8 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/footrest/http_error.rb', line 8 def status @status end |
Instance Method Details
#errors ⇒ Object
19 20 21 22 23 |
# File 'lib/footrest/http_error.rb', line 19 def errors JSON::pretty_generate(JSON::parse(@body)["errors"]) rescue @body end |