Class: KeyPayAPI::ResourceCollection
- Includes:
- Enumerable
- Defined in:
- lib/keypay_api/resource_collection.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from Resource
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(client, data, options = {}) ⇒ ResourceCollection
constructor
A new instance of ResourceCollection.
Methods inherited from Resource
Constructor Details
#initialize(client, data, options = {}) ⇒ ResourceCollection
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/keypay_api/resource_collection.rb', line 7 def initialize(client, data, = {}) @client = client collection = Array(data).map do |item| Resource.new(client, item) end @data = OpenStruct.new(collection: collection) = .with_indifferent_access end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class KeyPayAPI::Resource
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/keypay_api/resource_collection.rb', line 5 def end |
Instance Method Details
#each ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/keypay_api/resource_collection.rb', line 18 def each return enum_for(:each) unless block_given? collection.each { |item| yield item } return self end |