Method: RTX::API::CollectionV2#all_pages

Defined in:
lib/rtx/api/collection_v2.rb

#all_pages(&block) ⇒ Object

Allows you to loop through all of the pages and retrieve the records



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/rtx/api/collection_v2.rb', line 60

def all_pages(&block)
  loop do
    # Return first page
    block.call(data)

    # No need to continue if all data is retrieved
    break unless has_next?

    # Navigate to the next page
    self.next
  end
end