class Snov::GetProspectList

Attributes

client[R]
list_id[R]
page[R]
per_page[R]

Public Class Methods

new(list_id:, page:, per_page: 100, client: Snov.client) click to toggle source
# File lib/snov/get_prospect_list.rb, line 9
def initialize(list_id:, page:, per_page: 100, client: Snov.client)
  @client = client
  @list_id = list_id
  @page = page
  @per_page = per_page
end

Public Instance Methods

each(&block) click to toggle source
# File lib/snov/get_prospect_list.rb, line 16
def each(&block)
  prospects.each(&block)
end
prospects() click to toggle source
# File lib/snov/get_prospect_list.rb, line 20
def prospects
  @prospects ||= raw_result.fetch('prospects').map do |result|
    ProspectResult.new(result)
  end
end
raw_result() click to toggle source
# File lib/snov/get_prospect_list.rb, line 26
def raw_result
  @raw_result ||= client.post("/v1/prospect-list",
                              'listId' => list_id.to_s,
                              'page' => page.to_s,
                              'perPage' => per_page.to_s)
                        .deep_transform_keys! { |key| key.underscore }
end