Class: Klaviyo::Resource::KlaviyoCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/klaviyo/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#itemsObject (readonly)

Returns the value of attribute items.



22
23
24
# File 'lib/klaviyo/resource.rb', line 22

def items
  @items
end

#metaObject (readonly)

Returns the value of attribute meta.



22
23
24
# File 'lib/klaviyo/resource.rb', line 22

def meta
  @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