Class: Hactor::HTTP::Response
- Inherits:
-
Delegator
- Object
- Delegator
- Hactor::HTTP::Response
- Extended by:
- Forwardable
- Defined in:
- lib/hactor/http/response.rb
Instance Attribute Summary collapse
-
#codec ⇒ Object
readonly
Returns the value of attribute codec.
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #__getobj__ ⇒ Object
- #body ⇒ Object
-
#initialize(response, options = {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response, options = {}) ⇒ Response
Returns a new instance of Response.
19 20 21 22 23 24 |
# File 'lib/hactor/http/response.rb', line 19 def initialize(response, ={}) @http_client = .fetch(:http_client) @codec = .fetch(:codec) { Hactor::HAL::Document } @body = [:body] @response = response end |
Instance Attribute Details
#codec ⇒ Object (readonly)
Returns the value of attribute codec.
10 11 12 |
# File 'lib/hactor/http/response.rb', line 10 def codec @codec end |
#http_client ⇒ Object
Returns the value of attribute http_client.
11 12 13 |
# File 'lib/hactor/http/response.rb', line 11 def http_client @http_client end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/hactor/http/response.rb', line 10 def response @response end |
Instance Method Details
#__getobj__ ⇒ Object
31 32 33 |
# File 'lib/hactor/http/response.rb', line 31 def __getobj__ response end |
#body ⇒ Object
26 27 28 29 |
# File 'lib/hactor/http/response.rb', line 26 def body @body ||= codec.new __getobj__.body, response: self end |