Sha256: 514d60b6af59cc6c10ab300dfe1d95c25665cfec18ea4c1b9792a83b6d9f62d1
Contents?: true
Size: 550 Bytes
Versions: 6
Compression:
Stored size: 550 Bytes
Contents
# frozen_string_literal: true module Pipedrive module Utils extend ActiveSupport::Concern def follow_pagination(method, args, params, &block) start = params[:start] || 0 loop do res = __send__(method, *args, params.merge(start: start)) break if !res.try(:data) || !res.success? res.data.each(&block) break unless res.try(:additional_data).try(:pagination).try(:more_items_in_collection?) start = res.try(:additional_data).try(:pagination).try(:next_start) end end end end
Version data entries
6 entries across 6 versions & 2 rubygems