Class: Snov::GetEmailsFromName
- Inherits:
-
Object
- Object
- Snov::GetEmailsFromName
- Defined in:
- lib/snov/get_emails_from_name.rb
Defined Under Namespace
Classes: ProspectResult, ProspectStatus
Constant Summary collapse
- InvalidProspectResultError =
Class.new(InvalidResponseError)
- ProspectData =
Class.new(CamelSnakeStruct)
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client: Snov.client, first_name:, last_name:, domain:) ⇒ GetEmailsFromName
constructor
A new instance of GetEmailsFromName.
- #prospect ⇒ Object
- #raw_result ⇒ Object
Constructor Details
#initialize(client: Snov.client, first_name:, last_name:, domain:) ⇒ GetEmailsFromName
Returns a new instance of GetEmailsFromName.
7 8 9 10 11 12 |
# File 'lib/snov/get_emails_from_name.rb', line 7 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
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/snov/get_emails_from_name.rb', line 3 def client @client end |
Instance Method Details
#prospect ⇒ Object
14 15 16 17 18 |
# File 'lib/snov/get_emails_from_name.rb', line 14 def prospect @prospect ||= ProspectResult.new(raw_result) rescue ArgumentError, NoMethodError => e raise InvalidProspectResultError.new(e., response: raw_result) end |
#raw_result ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/snov/get_emails_from_name.rb', line 20 def raw_result @raw_result ||= client.post("/v1/get-emails-from-names", "firstName" => @first_name, "lastName" => @last_name, "domain" => @domain) .deep_transform_keys! { |key| key.underscore } end |