class Snov::GetProspectsByEmail

Attributes

client[R]
email[R]

Public Class Methods

new(email:, client: Snov.client) click to toggle source
# File lib/snov/get_prospects_by_email.rb, line 10
def initialize(email:, client: Snov.client)
  @client = client
  @email = email.to_str
end

Public Instance Methods

each(&block) click to toggle source
# File lib/snov/get_prospects_by_email.rb, line 15
def each(&block)
  prospects.each(&block)
end
prospects() click to toggle source
# File lib/snov/get_prospects_by_email.rb, line 19
def prospects
  @prospects ||= raw_result.fetch('data', []).map do |result|
    ProspectResult.new(result)
  end
end
raw_result() click to toggle source
# File lib/snov/get_prospects_by_email.rb, line 25
def raw_result
  @raw_result ||= client.post("/v1/get-prospects-by-email",
                              'email' => email)
                        .deep_transform_keys! { |key| key.underscore }
end