Class: Terrestrial::Web::Response
- Inherits:
-
Object
- Object
- Terrestrial::Web::Response
- Defined in:
- lib/terrestrial/web/response.rb
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(http_response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(http_response) ⇒ Response
Returns a new instance of Response.
4 5 6 |
# File 'lib/terrestrial/web/response.rb', line 4 def initialize(http_response) @inner_response = http_response end |
Instance Method Details
#body ⇒ Object
12 13 14 |
# File 'lib/terrestrial/web/response.rb', line 12 def body JSON.parse(@inner_response.body) end |
#success? ⇒ Boolean
8 9 10 |
# File 'lib/terrestrial/web/response.rb', line 8 def success? @inner_response.code.to_s.start_with?("2") end |