Class: Terrestrial::Web::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/terrestrial/web/response.rb

Instance Method Summary collapse

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

#bodyObject



12
13
14
# File 'lib/terrestrial/web/response.rb', line 12

def body
  JSON.parse(@inner_response.body)
end

#success?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/terrestrial/web/response.rb', line 8

def success?
  @inner_response.code.to_s.start_with?("2")
end