class Layer::ResourceCollection
Attributes
client[R]
params[R]
resource[R]
Public Class Methods
new(resource, client)
click to toggle source
Calls superclass method
# 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
Private Instance Methods
next_page()
click to toggle source
# File lib/layer/resource_collection.rb, line 22 def next_page response = client.get(resource.url, {}, { params: params }) return nil if response.empty? params[:from_id] = Layer::Client.normalize_id(response.last['id']) response end