Class: Halchemy::Resource
- Inherits:
-
Hash
- Object
- Hash
- Halchemy::Resource
- Defined in:
- lib/halchemy/resource.rb
Overview
The Resource class extends a Hash to include a metadata object containing details about the HTTP request and response. This lets the metadata stay “out of the way” allowing the client code to use the result of a request directly as a resource without losing access to the request details, response details, and any error details.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#_halchemy ⇒ Object
Returns the value of attribute _halchemy.
Instance Method Summary collapse
Instance Attribute Details
#_halchemy ⇒ Object
Returns the value of attribute _halchemy.
14 15 16 |
# File 'lib/halchemy/resource.rb', line 14 def _halchemy @_halchemy end |
Instance Method Details
#to_s ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/halchemy/resource.rb', line 16 def to_s if !keys.empty? to_json else _halchemy&.response&.body.to_s end end |