class Hubspot::PagedCollection

Attributes

limit[RW]
offset[RW]

Public Class Methods

new(opts = {}, &block) click to toggle source
Calls superclass method Hubspot::Collection::new
# File lib/hubspot/paged_collection.rb, line 4
def initialize(opts = {}, &block)
  @limit_param = opts.delete(:limit_param) || "limit"
  @limit = opts.delete(:limit) || 25
  @offset_param = opts.delete(:offset_param) || "offset"
  @offset = opts.delete(:offset)

  super(opts, &block)
end

Public Instance Methods

more?() click to toggle source
# File lib/hubspot/paged_collection.rb, line 13
def more?
  @has_more
end
next_offset() click to toggle source
# File lib/hubspot/paged_collection.rb, line 17
def next_offset
  @next_offset
end
next_page() click to toggle source
# File lib/hubspot/paged_collection.rb, line 25
def next_page
  @offset = next_offset
  fetch
  self
end
next_page?() click to toggle source
# File lib/hubspot/paged_collection.rb, line 21
def next_page?
  @has_more
end

Protected Instance Methods

fetch() click to toggle source
# File lib/hubspot/paged_collection.rb, line 32
def fetch
  @resources, @next_offset, @has_more = @fetch_proc.call(@options, @offset, @limit)
end