Class: Hubspot::PagedCollection
- Inherits:
-
Collection
- Object
- Collection
- Hubspot::PagedCollection
- Defined in:
- lib/hubspot/paged_collection.rb
Instance Attribute Summary collapse
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#offset ⇒ Object
Returns the value of attribute offset.
Instance Method Summary collapse
-
#initialize(opts = {}, &block) ⇒ PagedCollection
constructor
A new instance of PagedCollection.
- #more? ⇒ Boolean
- #next_offset ⇒ Object
- #next_page ⇒ Object
- #next_page? ⇒ Boolean
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
#limit ⇒ Object
Returns the value of attribute limit.
2 3 4 |
# File 'lib/hubspot/paged_collection.rb', line 2 def limit @limit end |
#offset ⇒ Object
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
13 14 15 |
# File 'lib/hubspot/paged_collection.rb', line 13 def more? @has_more end |
#next_offset ⇒ Object
17 18 19 |
# File 'lib/hubspot/paged_collection.rb', line 17 def next_offset @next_offset end |
#next_page ⇒ Object
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
21 22 23 |
# File 'lib/hubspot/paged_collection.rb', line 21 def next_page? @has_more end |