lib/gocardless_pro/paginator.rb
# Get a lazy enumerable for listing data from the API
Get a lazy enumerable for listing data from the API
Get a lazy enumerable for listing data from the API
def enumerator
      response = get_initial_response
      Enumerator.new do |yielder|
        loop do
          response.records.each { |item| yielder << item }
          after_cursor = response.after
          break if after_cursor.nil?
          @options[:params] ||= {}
          @options[:params] = @options[:params].merge(after: after_cursor)
          response = @service.list(@options.merge(after: after_cursor))
        end
      end.lazy
    end
def enumerator response = get_initial_response Enumerator . new do | yielder | loop do response . records . each { | item | yielder << item } after_cursor = response . after break if after_cursor . nil? @options [ :params ] ||= { } @options [ :params ] = @options [ :params ] . merge ( after : after_cursor ) response = @service . list ( @options . merge ( after : after_cursor ) ) end end . lazy end
Get a lazy enumerable for listing data from the API
Get a lazy enumerable for listing data from the API