module SquarespaceApi::PaginatedFetch
Public Class Methods
build(params = {}) { |params| ... }
click to toggle source
# File lib/squarespace_api/paginated_fetch.rb, line 3 def self.build(params = {}, &_block) loop do response = yield(params) has_next_page = response.dig('pagination', 'hasNextPage').to_s == 'true' break unless has_next_page params = { cursor: response.dig('pagination', 'nextPageCursor') } end end