Class: Klaviyo::Resource::KlaviyoCollection
- Inherits:
-
Object
- Object
- Klaviyo::Resource::KlaviyoCollection
- Includes:
- Enumerable
- Defined in:
- lib/klaviyo/resource.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Instance Method Summary collapse
- #each(&blk) ⇒ Object
-
#initialize(data) ⇒ KlaviyoCollection
constructor
A new instance of KlaviyoCollection.
Constructor Details
#initialize(data) ⇒ KlaviyoCollection
Returns a new instance of KlaviyoCollection.
24 25 26 27 |
# File 'lib/klaviyo/resource.rb', line 24 def initialize(data) @items = data.delete('data').map { |attrs| Klaviyo::Resource.build(attrs) } @meta = data end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
22 23 24 |
# File 'lib/klaviyo/resource.rb', line 22 def items @items end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
22 23 24 |
# File 'lib/klaviyo/resource.rb', line 22 def @meta end |
Instance Method Details
#each(&blk) ⇒ Object
29 30 31 |
# File 'lib/klaviyo/resource.rb', line 29 def each(&blk) item.each(&blk) end |