Class: Infurarb::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_response, request) ⇒ Response

Returns a new instance of Response.



4
5
6
7
# File 'lib/infurarb/response.rb', line 4

def initialize(http_response, request)
  @http_response = http_response
  @request = request
end

Instance Attribute Details

#http_responseObject (readonly)

Returns the value of attribute http_response.



3
4
5
# File 'lib/infurarb/response.rb', line 3

def http_response
  @http_response
end

#requestObject (readonly)

Returns the value of attribute request.



3
4
5
# File 'lib/infurarb/response.rb', line 3

def request
  @request
end

Instance Method Details

#bodyObject



9
10
11
# File 'lib/infurarb/response.rb', line 9

def body
  @body ||= JSON.parse(http_response.body.readpartial)
end