Class: Espago::Response
- Inherits:
-
Object
- Object
- Espago::Response
- Defined in:
- lib/espago/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #card ⇒ Object
- #created_at ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #method_missing(attribute_name) ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
9 10 11 12 |
# File 'lib/espago/response.rb', line 9 def initialize(response) @body = parse(response.body) @status = response.status end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(attribute_name) ⇒ Object
14 15 16 |
# File 'lib/espago/response.rb', line 14 def method_missing(attribute_name) body[attribute_name.to_s] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/espago/response.rb', line 7 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/espago/response.rb', line 6 def status @status end |
Instance Method Details
#card ⇒ Object
18 19 20 |
# File 'lib/espago/response.rb', line 18 def card body["card"] || {} end |
#created_at ⇒ Object
22 23 24 |
# File 'lib/espago/response.rb', line 22 def created_at Time.at(body["created_at"]) rescue nil end |