Class: Hyperclient::ResourceCollection
- Inherits:
-
Collection
- Object
- Collection
- Hyperclient::ResourceCollection
- Defined in:
- lib/hyperclient/resource_collection.rb
Overview
A wrapper class to easily acces the embedded resources in a Resource.
Instance Method Summary collapse
- #build_resource(representation) ⇒ Object private
-
#initialize(collection, entry_point) ⇒ ResourceCollection
constructor
Initializes a ResourceCollection.
Methods inherited from Collection
#[], #each, #fetch, #include?, #method_missing, #respond_to_missing?, #to_h, #to_s
Constructor Details
#initialize(collection, entry_point) ⇒ ResourceCollection
Initializes a ResourceCollection.
16 17 18 19 20 21 |
# File 'lib/hyperclient/resource_collection.rb', line 16 def initialize(collection, entry_point) @entry_point = entry_point @collection = (collection || {}).reduce({}) do |hash, (name, resource)| hash.update(name => build_resource(resource)) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Hyperclient::Collection