Class: Snov::AddNamesToFindEmails

Inherits:
Object
  • Object
show all
Defined in:
lib/snov/add_names_to_find_emails.rb

Defined Under Namespace

Classes: ProspectResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: Snov.client, first_name:, last_name:, domain:) ⇒ AddNamesToFindEmails

Returns a new instance of AddNamesToFindEmails.



5
6
7
8
9
10
# File 'lib/snov/add_names_to_find_emails.rb', line 5

def initialize(client: Snov.client, first_name:, last_name:, domain:)
  @client = client
  @first_name = first_name
  @last_name = last_name
  @domain = domain
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/snov/add_names_to_find_emails.rb', line 3

def client
  @client
end

Instance Method Details

#addObject



12
13
14
# File 'lib/snov/add_names_to_find_emails.rb', line 12

def add
  @add ||= ProspectResult.new(raw_result)
end

#raw_resultObject



16
17
18
19
20
21
22
# File 'lib/snov/add_names_to_find_emails.rb', line 16

def raw_result
  @raw_result ||= client.post("/v1/add-names-to-find-emails",
                              "firstName" => @first_name,
                              "lastName" => @last_name,
                              "domain" => @domain)
                        .deep_transform_keys! { |key| key.underscore }
end