Exception: Hatt::RequestException
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Hatt::RequestException
- Includes:
- JsonHelpers
- Defined in:
- lib/hatt/http.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #body ⇒ Object
-
#code ⇒ Object
shortcut methods.
-
#initialize(request, response) ⇒ RequestException
constructor
A new instance of RequestException.
-
#to_s ⇒ Object
this makes good info show up in rspec reports.
Methods included from JsonHelpers
Constructor Details
#initialize(request, response) ⇒ RequestException
Returns a new instance of RequestException.
223 224 225 226 |
# File 'lib/hatt/http.rb', line 223 def initialize(request, response) @request = request @response = response end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
227 228 229 |
# File 'lib/hatt/http.rb', line 227 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
227 228 229 |
# File 'lib/hatt/http.rb', line 227 def response @response end |
Instance Method Details
#body ⇒ Object
239 240 241 |
# File 'lib/hatt/http.rb', line 239 def body objectify(@response.body) end |
#code ⇒ Object
shortcut methods
235 236 237 |
# File 'lib/hatt/http.rb', line 235 def code @response.status end |
#to_s ⇒ Object
this makes good info show up in rspec reports
230 231 232 |
# File 'lib/hatt/http.rb', line 230 def to_s "#{self.class}\nResponseCode: #{code}\nResponseBody:\n#{body}" end |