Class: TumblrWrapper::Response
- Inherits:
-
Object
- Object
- TumblrWrapper::Response
- Defined in:
- lib/tumblr_wrapper/response.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(faraday_response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(faraday_response) ⇒ Response
Returns a new instance of Response.
3 4 5 6 7 8 |
# File 'lib/tumblr_wrapper/response.rb', line 3 def initialize(faraday_response) @faraday_response = faraday_response @status = faraday_response.status @response = faraday_response.body["response"] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object (private)
24 25 26 27 28 29 30 31 |
# File 'lib/tumblr_wrapper/response.rb', line 24 def method_missing(meth, *args, &block) if response && response.keys.include?(meth.to_s) r = response[meth.to_s] r.respond_to?(:keys) ? r.with_indifferent_access : r else super end end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
2 3 4 |
# File 'lib/tumblr_wrapper/response.rb', line 2 def @message end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
2 3 4 |
# File 'lib/tumblr_wrapper/response.rb', line 2 def status @status end |