Exception: FatZebra::RequestError
- Inherits:
-
StandardError
- Object
- StandardError
- FatZebra::RequestError
- Defined in:
- lib/fat_zebra/errors.rb
Overview
Request to API Error
Instance Attribute Summary collapse
-
#http_body ⇒ Object
readonly
Returns the value of attribute http_body.
-
#http_message ⇒ Object
readonly
Returns the value of attribute http_message.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#http_status_type ⇒ Object
readonly
Returns the value of attribute http_status_type.
Instance Method Summary collapse
-
#initialize(response, message: nil) ⇒ RequestError
constructor
A new instance of RequestError.
- #to_s ⇒ Object
Constructor Details
#initialize(response, message: nil) ⇒ RequestError
Returns a new instance of RequestError.
23 24 25 26 27 28 |
# File 'lib/fat_zebra/errors.rb', line 23 def initialize(response, message: nil) @http_status = response.code.to_i @http_status_type = response.code_type @http_body = response.body @http_message = || response. end |
Instance Attribute Details
#http_body ⇒ Object (readonly)
Returns the value of attribute http_body.
21 22 23 |
# File 'lib/fat_zebra/errors.rb', line 21 def http_body @http_body end |
#http_message ⇒ Object (readonly)
Returns the value of attribute http_message.
21 22 23 |
# File 'lib/fat_zebra/errors.rb', line 21 def @http_message end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
21 22 23 |
# File 'lib/fat_zebra/errors.rb', line 21 def http_status @http_status end |
#http_status_type ⇒ Object (readonly)
Returns the value of attribute http_status_type.
21 22 23 |
# File 'lib/fat_zebra/errors.rb', line 21 def http_status_type @http_status_type end |
Instance Method Details
#to_s ⇒ Object
30 31 32 |
# File 'lib/fat_zebra/errors.rb', line 30 def to_s "Status #{http_status}: #{}" end |