class Restforce::Collection
def current_page
def current_page first(@raw_page['records'].size) end
def each
def each @raw_page['records'].each { |record| yield Restforce::Mash.build(record, @client) } np = next_page while np np.current_page.each { |record| yield record } np = np.next_page end end
def has_next_page?
def has_next_page? !@raw_page['nextRecordsUrl'].nil? end
def initialize(hash, client)
Given a hash and client, will create an Enumerator that will lazily
def initialize(hash, client) @client = client @raw_page = hash end
def next_page
def next_page @client.get(@raw_page['nextRecordsUrl']).body if has_next_page? end
def page_size
def page_size @raw_page['records'].size end
def pages
def pages [self] + (has_next_page? ? next_page.pages : []) end
def size
def size @raw_page['totalSize'] end