class KlaviyoAPI::Collections::MarkerCollection
This collection is used for item types that rely on markers to provide pagination.
Attributes
count[RW]
marker[RW]
next[RW]
Public Class Methods
new(response = {})
click to toggle source
# File lib/klaviyo_api/collections/marker_collection.rb, line 9 def initialize(response = {}) # May not exist @count = response.delete 'count' @next = response['next'] || response['marker'] @marker = @next @elements = response['data'] || response['records'] || [] end
Public Instance Methods
more_pages?()
click to toggle source
# File lib/klaviyo_api/collections/marker_collection.rb, line 23 def more_pages? !@next.nil? end
next_page()
click to toggle source
# File lib/klaviyo_api/collections/marker_collection.rb, line 27 def next_page # Return empty collection if no other pages return self.class.new unless more_pages? first.class.all params: { **first.prefix_options, **original_params, "#{next_page_marker_name}": marker } end
next_page_marker_name()
click to toggle source
# File lib/klaviyo_api/collections/marker_collection.rb, line 19 def next_page_marker_name 'marker' end