Method: EasyPost::Services::Tracker#get_next_page

Defined in:
lib/easypost/services/tracker.rb

#get_next_page(collection, page_size = nil) ⇒ Object

Get the next page of trackers.



40
41
42
43
44
45
46
47
48
# File 'lib/easypost/services/tracker.rb', line 40

def get_next_page(collection, page_size = nil)
  raise EasyPost::Errors::EndOfPaginationError.new unless more_pages?(collection)

  params = { before_id: collection.trackers.last.id }
  params[:page_size] = page_size unless page_size.nil?
  params.merge!(collection[EasyPost::InternalUtilities::Constants::FILTERS_KEY]).delete(:key)

  all(params)
end