class Snov::GetAllProspectsFromList

Attributes

client[R]
list_id[R]
max[R]
per_page[R]

Public Class Methods

new(list_id:, max: 9999, per_page: 100, client: Snov.client) click to toggle source
# File lib/snov/get_all_prospects_from_list.rb, line 7
def initialize(list_id:, max: 9999, per_page: 100, client: Snov.client)
  @client = client
  @list_id = list_id
  @max = max.to_int
  @per_page = per_page
end

Public Instance Methods

each(&block) click to toggle source
# File lib/snov/get_all_prospects_from_list.rb, line 14
def each(&block)
  (1..max).each do |page|
    list = GetProspectList.new(list_id: list_id, page: page, per_page: per_page,
                               client: client)
    prospects = list.prospects

    prospects.each(&block)

    break if prospects.size < per_page
  end
end