Exception: Okapi::RequestError
- Inherits:
-
StandardError
- Object
- StandardError
- Okapi::RequestError
- Defined in:
- lib/okapi.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(response) ⇒ RequestError
constructor
A new instance of RequestError.
Constructor Details
#initialize(response) ⇒ RequestError
108 109 110 |
# File 'lib/okapi.rb', line 108 def initialize(response) super("#{response.class.to_s}: #{response.body}") end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
106 107 108 |
# File 'lib/okapi.rb', line 106 def response @response end |
Class Method Details
.maybe_fail!(response) ⇒ Object
112 113 114 |
# File 'lib/okapi.rb', line 112 def self.maybe_fail!(response) fail new(response) unless response.code.to_i >= 200 && response.code.to_i < 300 end |