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.
226 227 228 229 |
# File 'lib/hatt/http.rb', line 226 def initialize(request, response) @request = request @response = response end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
230 231 232 |
# File 'lib/hatt/http.rb', line 230 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
230 231 232 |
# File 'lib/hatt/http.rb', line 230 def response @response end |
Instance Method Details
#body ⇒ Object
242 243 244 |
# File 'lib/hatt/http.rb', line 242 def body objectify(@response.body) end |
#code ⇒ Object
shortcut methods
238 239 240 |
# File 'lib/hatt/http.rb', line 238 def code @response.status end |
#to_s ⇒ Object
this makes good info show up in rspec reports
233 234 235 |
# File 'lib/hatt/http.rb', line 233 def to_s "#{self.class}\nResponseCode: #{code}\nResponseBody:\n#{body}" end |