Class: Snov::GetProspectsByEmail
- Inherits:
-
Object
- Object
- Snov::GetProspectsByEmail
- Includes:
- Enumerable
- Defined in:
- lib/snov/get_prospects_by_email.rb
Defined Under Namespace
Classes: Job, List, ProspectResult, Social
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(email:, client: Snov.client) ⇒ GetProspectsByEmail
constructor
A new instance of GetProspectsByEmail.
- #prospects ⇒ Object
- #raw_result ⇒ Object
Constructor Details
#initialize(email:, client: Snov.client) ⇒ GetProspectsByEmail
Returns a new instance of GetProspectsByEmail.
10 11 12 13 |
# File 'lib/snov/get_prospects_by_email.rb', line 10 def initialize(email:, client: Snov.client) @client = client @email = email.to_str end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/snov/get_prospects_by_email.rb', line 8 def client @client end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
8 9 10 |
# File 'lib/snov/get_prospects_by_email.rb', line 8 def email @email end |
Instance Method Details
#each(&block) ⇒ Object
15 16 17 |
# File 'lib/snov/get_prospects_by_email.rb', line 15 def each(&block) prospects.each(&block) end |
#prospects ⇒ Object
19 20 21 22 23 |
# 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 ⇒ Object
25 26 27 28 29 |
# 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 |