Class: Hubspot::PagedCollection

Inherits:
Collection show all
Defined in:
lib/hubspot/paged_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Collection

#refresh, #resources, #update_all

Constructor Details

#initialize(opts = {}, &block) ⇒ PagedCollection

Returns a new instance of PagedCollection.



4
5
6
7
8
9
10
11
# 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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hubspot::Collection

Instance Attribute Details

#limitObject

Returns the value of attribute limit.



2
3
4
# File 'lib/hubspot/paged_collection.rb', line 2

def limit
  @limit
end

#offsetObject

Returns the value of attribute offset.



2
3
4
# File 'lib/hubspot/paged_collection.rb', line 2

def offset
  @offset
end

Instance Method Details

#more?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/hubspot/paged_collection.rb', line 13

def more?
  @has_more
end

#next_offsetObject



17
18
19
# File 'lib/hubspot/paged_collection.rb', line 17

def next_offset
  @next_offset
end

#next_pageObject



25
26
27
28
29
# File 'lib/hubspot/paged_collection.rb', line 25

def next_page
  @offset = next_offset
  fetch
  self
end

#next_page?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/hubspot/paged_collection.rb', line 21

def next_page?
  @has_more
end