Sha256: c9022fb8da39646c19aa408dcd4e1b26fc984f68b6d6f7bf5821d0c13dba0c0c

Contents?: true

Size: 642 Bytes

Versions: 14

Compression:

Stored size: 642 Bytes

Contents

class Hubspot::PagedCollection < Hubspot::Collection
  attr_accessor :offset, :limit

  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

  def more?
    @has_more
  end

  def next_offset
    @next_offset
  end

  def next_page?
    @has_more
  end

  def next_page
    @offset = next_offset
    fetch
    self
  end

protected
  def fetch
    @resources, @next_offset, @has_more = @fetch_proc.call(@options, @offset, @limit)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hubspot-api-ruby-0.19.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.18.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.17.1 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.17.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.16.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.15.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.14.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.13.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.12.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.11.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.10.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.9.0 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.8.1 lib/hubspot/paged_collection.rb
hubspot-api-ruby-0.8.0 lib/hubspot/paged_collection.rb