Class: SocialProfile::Response
- Inherits:
-
Object
- Object
- SocialProfile::Response
- Defined in:
- lib/social_profile/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(uri, response, options = {}) ⇒ Response
constructor
A new instance of Response.
- #respond_to?(name) ⇒ Boolean
Constructor Details
#initialize(uri, response, options = {}) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 |
# File 'lib/social_profile/response.rb', line 5 def initialize(uri, response, ={}) @uri = uri @response = response @body = response.body || [:body] @headers = response.to_hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object (protected)
23 24 25 26 27 28 29 |
# File 'lib/social_profile/response.rb', line 23 def method_missing(name, *args, &block) if response.respond_to?(name) response.send(name, *args, &block) else super end end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/social_profile/response.rb', line 3 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
3 4 5 |
# File 'lib/social_profile/response.rb', line 3 def headers @headers end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/social_profile/response.rb', line 3 def response @response end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
3 4 5 |
# File 'lib/social_profile/response.rb', line 3 def uri @uri end |
Instance Method Details
#code ⇒ Object
12 13 14 |
# File 'lib/social_profile/response.rb', line 12 def code response.code.to_i end |
#respond_to?(name) ⇒ Boolean
16 17 18 19 |
# File 'lib/social_profile/response.rb', line 16 def respond_to?(name) return true if [:uri, :response, :body, :headers].include?(name) response.respond_to?(name) end |