Module: Restfulie::Client::HTTP::ResponseHolder
- Defined in:
- lib/restfulie/client/http/response_holder.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #at(uri) ⇒ Object
- #headers ⇒ Object
- #resource ⇒ Object
- #results_from(request, response) ⇒ Object
- #verb ⇒ Object
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
3 4 5 |
# File 'lib/restfulie/client/http/response_holder.rb', line 3 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/restfulie/client/http/response_holder.rb', line 3 def response @response end |
Instance Method Details
#at(uri) ⇒ Object
11 12 13 |
# File 'lib/restfulie/client/http/response_holder.rb', line 11 def at(uri) request.clone.at(uri) end |
#headers ⇒ Object
15 16 17 |
# File 'lib/restfulie/client/http/response_holder.rb', line 15 def headers response.to_hash.extend(::Restfulie::Client::HTTP::LinkHeader) end |
#resource ⇒ Object
5 6 7 8 9 |
# File 'lib/restfulie/client/http/response_holder.rb', line 5 def resource type = headers['content-type'] || response['Content-Type'] representation = Medie.registry.for(type[0]) representation.unmarshal(response.body) end |
#results_from(request, response) ⇒ Object
19 20 21 22 |
# File 'lib/restfulie/client/http/response_holder.rb', line 19 def results_from(request, response) @request = request @response = response end |
#verb ⇒ Object
24 25 26 |
# File 'lib/restfulie/client/http/response_holder.rb', line 24 def verb @request.verb end |