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 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 |