Module: SquarespaceApi::PaginatedFetch
- Defined in:
- lib/squarespace_api/paginated_fetch.rb
Class Method Summary collapse
Class Method Details
.build(params = {}, &_block) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/squarespace_api/paginated_fetch.rb', line 3 def self.build(params = {}, &_block) loop do pagination = yield(params) has_next_page = !!pagination&.dig('hasNextPage') break if not has_next_page params = { cursor: pagination['nextPageCursor'] } end end |