Class: Polyseerio::Response

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

Overview

HTTP response wrapper.

Instance Method Summary collapse

Constructor Details

#initialize(rest_response) ⇒ Response

Returns a new instance of Response.



7
8
9
# File 'lib/response.rb', line 7

def initialize(rest_response)
  @rest_response = rest_response
end

Instance Method Details

#bodyObject

Returns the response body.

NOTE: This function is memoized.



14
15
16
# File 'lib/response.rb', line 14

def body
  @body_result ||= JSON.parse(@rest_response.body, symbolize_names: true)
end

#requestObject

Returns the original request obect.



19
20
21
# File 'lib/response.rb', line 19

def request
  @rest_response.request
end