class ScriptedClient::Collection

Attributes

next_page[RW]

Public Class Methods

new(parsed = {}) click to toggle source
# File lib/scripted_client/collection.rb, line 6
def initialize(parsed = {})
  @elements = parsed['data']
  paging = parsed['paging']
  @next_page = paging['next_cursor'] if paging && paging['has_next']
end

Public Instance Methods

has_next?() click to toggle source
# File lib/scripted_client/collection.rb, line 19
def has_next?
  next_page.present?
end
next() click to toggle source
# File lib/scripted_client/collection.rb, line 12
def next
  fail 'No more pages' unless has_next?
  resource_class.all(
    params: original_params.merge(next_cursor: next_page)
  )
end