Class: Modulr::Resources::BaseCollection
- Inherits:
-
Object
- Object
- Modulr::Resources::BaseCollection
- Includes:
- Enumerable
- Defined in:
- lib/modulr/resources/base_collection.rb
Direct Known Subclasses
Accounts::Identifiers, Notifications::Collection, Payments::Collection, Transactions::Transactions
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(response, item_klass, attributes_collection = []) ⇒ BaseCollection
constructor
A new instance of BaseCollection.
Constructor Details
#initialize(response, item_klass, attributes_collection = []) ⇒ BaseCollection
Returns a new instance of BaseCollection.
10 11 12 13 |
# File 'lib/modulr/resources/base_collection.rb', line 10 def initialize(response, item_klass, attributes_collection = []) @response = response @items = attributes_collection.map { |attributes| item_klass.new(nil, attributes) } end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/modulr/resources/base_collection.rb', line 6 def response @response end |
Instance Method Details
#each(&block) ⇒ Object
15 16 17 |
# File 'lib/modulr/resources/base_collection.rb', line 15 def each(&block) @items.each(&block) end |