snov 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67d94e3b6c521ed1d7d4d2c85dee46fe46309db78e3323bdd476a8f6fb62c33d
4
- data.tar.gz: ce1bb1e0ced90ae3d6f54ae92cc135d84171f5112143af9da3f3027e1cf5ad65
3
+ metadata.gz: 29a980f1ec57e85a5f0fbf089fdcb646e5a66454c91515d90e33b7aaec042ac6
4
+ data.tar.gz: 17e52baa847e7f42eba8696e35509f7478582696092a8e0cd229cf108c097d5c
5
5
  SHA512:
6
- metadata.gz: 7915a6077c1a7ca1920564060a7a6b298a70e36e10f103c97500bf4b01a6805bfc87e25be700526ad8dc835fc8913f61d253f0bd1b31e26468ee0c7995effd5b
7
- data.tar.gz: 1b9250834a8ef6e22928f1e141ad4b6bc126698a5438ad4833734a54ca40043d888f4336349b4ef2e9028cc6d3b307becf8a729be4239cad714d8fc6f1b34ed9
6
+ metadata.gz: 9ce75c52ecf8c7bd180ad2a2b4ea510acb494b59060f779424c0d5db7888ca18c75d9eb16ed8b66b58e46555a193e89f41b8df760177f0bd70f6076e3b94a9b9
7
+ data.tar.gz: 41e171a1eaa943b01e82369979939f2f28523ed3a2835029453918965b324946a1507e8dae64df88980e603073d50d8d9c1de9612fd9f0017745cfca96733e0b
data/.byebug_history ADDED
@@ -0,0 +1,5 @@
1
+ continue
2
+ subject
3
+ exit
4
+ val["emails"]
5
+ val
data/README.md CHANGED
@@ -183,6 +183,21 @@ see https://snov.io/api#GetEmailsFromUrl
183
183
  end
184
184
  ```
185
185
 
186
+ ### GetEmailsFromName
187
+
188
+ convenience wrapper for `GetEmailsFromName` to get a prospect with name
189
+
190
+ see https://snov.io/api#EmailFinder
191
+
192
+ ```ruby
193
+ prospect = Snov::GetEmailsFromName.new(first_name: "gavin", last_name: "vanrooyen", domain: "octagon.com").prospect
194
+
195
+ prospect.data.emails.each do |value|
196
+ puts value.email
197
+ puts value.email_status
198
+ end
199
+ ```
200
+
186
201
  ## Development
187
202
 
188
203
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/lib/snov.rb CHANGED
@@ -25,4 +25,5 @@ require 'snov/get_prospects_by_email'
25
25
  require 'snov/get_prospect_list'
26
26
  require 'snov/get_user_lists'
27
27
  require 'snov/get_emails_by_social_url'
28
+ require 'snov/get_emails_from_name'
28
29
  require 'snov/domain_search'
@@ -0,0 +1,68 @@
1
+ module Snov
2
+ class GetEmailsFromName
3
+ attr_reader :client
4
+
5
+ def initialize(client: Snov.client, first_name:, last_name:, domain:)
6
+ @client = client
7
+ @first_name = first_name
8
+ @last_name = last_name
9
+ @domain = domain
10
+ end
11
+
12
+ def prospect
13
+ @prospect ||= ProspectResult.new(raw_result)
14
+ end
15
+
16
+ def raw_result
17
+ @raw_result ||= client.post("/v1/get-emails-from-names",
18
+ "firstName" => @first_name,
19
+ "lastName" => @last_name,
20
+ "domain" => @domain)
21
+ .deep_transform_keys! { |key| key.underscore }
22
+ end
23
+
24
+ class ProspectData
25
+ include ActiveModel::Model
26
+
27
+ attr_accessor :first_name, :last_name
28
+ attr_reader :emails
29
+
30
+ def emails=(val)
31
+ @emails = Array.wrap(val).map do |rel|
32
+ ProspectEmail.new(rel)
33
+ end
34
+ end
35
+ end
36
+
37
+ class ProspectEmail
38
+ include ActiveModel::Model
39
+
40
+ attr_accessor :email, :email_status
41
+ end
42
+
43
+ class ProspectStatus
44
+ include ActiveModel::Model
45
+
46
+ attr_accessor :identifier, :description
47
+
48
+ def completed?
49
+ identifier == 'complete'
50
+ end
51
+ end
52
+
53
+ class ProspectResult
54
+ include ActiveModel::Model
55
+
56
+ attr_accessor :success, :message, :params
57
+ attr_reader :data, :status
58
+
59
+ def data=(val)
60
+ @data = ProspectData.new(val)
61
+ end
62
+
63
+ def status=(val)
64
+ @status = ProspectStatus.new(val)
65
+ end
66
+ end
67
+ end
68
+ end
data/lib/snov/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Snov
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Petersen-Speelman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-05-17 00:00:00.000000000 Z
12
+ date: 2021-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -119,6 +119,7 @@ executables: []
119
119
  extensions: []
120
120
  extra_rdoc_files: []
121
121
  files:
122
+ - ".byebug_history"
122
123
  - ".gitignore"
123
124
  - ".rspec"
124
125
  - ".rubocop.yml"
@@ -148,6 +149,7 @@ files:
148
149
  - lib/snov/fake_client/post_v1_prospect-list/listId=1818597&page=1&perPage=100.json
149
150
  - lib/snov/get_all_prospects_from_list.rb
150
151
  - lib/snov/get_emails_by_social_url.rb
152
+ - lib/snov/get_emails_from_name.rb
151
153
  - lib/snov/get_profile_by_email.rb
152
154
  - lib/snov/get_prospect_list.rb
153
155
  - lib/snov/get_prospects_by_email.rb
@@ -177,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
179
  - !ruby/object:Gem::Version
178
180
  version: '0'
179
181
  requirements: []
180
- rubygems_version: 3.2.3
182
+ rubygems_version: 3.2.15
181
183
  signing_key:
182
184
  specification_version: 4
183
185
  summary: Snov client to interact with snov api