Class: HTTParty::Response
- Inherits:
- BasicObject
- Defined in:
- lib/httparty/response.rb
Overview
:nodoc:
Constant Summary collapse
- RESPONDS_TO =
/^((body|code|message|headers)=?|delegate)$/
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#code ⇒ Object
Returns the value of attribute code.
-
#delegate ⇒ Object
readonly
Returns the value of attribute delegate.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(delegate, body, code, message, headers = {}) ⇒ Response
constructor
A new instance of Response.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to?(method) ⇒ Boolean
Constructor Details
#initialize(delegate, body, code, message, headers = {}) ⇒ Response
Returns a new instance of Response.
8 9 10 11 12 13 14 |
# File 'lib/httparty/response.rb', line 8 def initialize(delegate, body, code, , headers={}) @delegate = delegate @body = body @code = code.to_i @message = @headers = headers end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
16 17 18 |
# File 'lib/httparty/response.rb', line 16 def method_missing(name, *args, &block) @delegate.send(name, *args, &block) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/httparty/response.rb', line 5 def body @body end |
#code ⇒ Object
Returns the value of attribute code.
5 6 7 |
# File 'lib/httparty/response.rb', line 5 def code @code end |
#delegate ⇒ Object (readonly)
Returns the value of attribute delegate.
6 7 8 |
# File 'lib/httparty/response.rb', line 6 def delegate @delegate end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/httparty/response.rb', line 5 def headers @headers end |
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/httparty/response.rb', line 5 def @message end |
Instance Method Details
#respond_to?(method) ⇒ Boolean
20 21 22 |
# File 'lib/httparty/response.rb', line 20 def respond_to?(method) return true if method.to_s.match(RESPONDS_TO) end |