Class: Layer::ResourceCollection

Inherits:
Enumerator
  • Object
show all
Defined in:
lib/layer/resource_collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource, client) ⇒ ResourceCollection

Returns a new instance of ResourceCollection.



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/layer/resource_collection.rb', line 4

def initialize(resource, client)
  @resource = resource
  @client = client
  @params = { page_size: 100 }

  super() do |yielder|
    while response = next_page
      response.map do |attributes|
        yielder << resource.from_response(attributes, client)
      end
    end
  end
end