Class: UrlShortener::Response
- Inherits:
-
Object
- Object
- UrlShortener::Response
- Defined in:
- lib/url_shortener/response.rb
Defined Under Namespace
Classes: Expand, Info, Shorten, Stats
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(result) ⇒ Response
constructor
A new instance of Response.
- #method_missing(method_name, *args) ⇒ Object
Constructor Details
#initialize(result) ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/url_shortener/response.rb', line 6 def initialize(result) @result = result @attributes = Hashie::Mash.new(result) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
11 12 13 14 |
# File 'lib/url_shortener/response.rb', line 11 def method_missing(method_name, *args) element = camelize(method_name) base_element.send(element.to_sym) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/url_shortener/response.rb', line 4 def attributes @attributes end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/url_shortener/response.rb', line 4 def result @result end |