snov 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.byebug_history +5 -0
- data/.rubocop.yml +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +11 -0
- data/README.md +49 -0
- data/lib/snov.rb +2 -0
- data/lib/snov/client.rb +2 -2
- data/lib/snov/fake_client.rb +1 -1
- data/lib/snov/fake_client/post_v1_prospect-list/{list_id=1479070&page=1&per_page=100.json → listId=1479070&page=1&perPage=100.json} +0 -0
- data/lib/snov/fake_client/post_v1_prospect-list/{list_id=1505383&page=1&per_page=100.json → listId=1505383&page=1&perPage=100.json} +0 -0
- data/lib/snov/fake_client/post_v1_prospect-list/{list_id=1818597&page=1&per_page=100.json → listId=1818597&page=1&perPage=100.json} +0 -0
- data/lib/snov/get_emails_by_social_url.rb +77 -0
- data/lib/snov/get_emails_from_name.rb +68 -0
- data/lib/snov/version.rb +1 -1
- data/snov.gemspec +4 -4
- metadata +16 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29a980f1ec57e85a5f0fbf089fdcb646e5a66454c91515d90e33b7aaec042ac6
|
4
|
+
data.tar.gz: 17e52baa847e7f42eba8696e35509f7478582696092a8e0cd229cf108c097d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce75c52ecf8c7bd180ad2a2b4ea510acb494b59060f779424c0d5db7888ca18c75d9eb16ed8b66b58e46555a193e89f41b8df760177f0bd70f6076e3b94a9b9
|
7
|
+
data.tar.gz: 41e171a1eaa943b01e82369979939f2f28523ed3a2835029453918965b324946a1507e8dae64df88980e603073d50d8d9c1de9612fd9f0017745cfca96733e0b
|
data/.byebug_history
ADDED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## [0.4.1]
|
2
|
+
* allow forward slash for test response files while using fake client
|
3
|
+
|
4
|
+
## [0.4.0]
|
5
|
+
* search prospect emails with /v1/get-emails-from-url
|
6
|
+
|
7
|
+
## [0.3.2]
|
8
|
+
* increase snov timeout to 90 seconds
|
9
|
+
## [0.3.1]
|
10
|
+
* fix fake result for /v1/prospect-list
|
11
|
+
|
1
12
|
## [0.3.0]
|
2
13
|
* add Faraday response into exception
|
3
14
|
* fake client to only return success result for selected queries
|
data/README.md
CHANGED
@@ -148,6 +148,55 @@ see https://snov.io/api#ViewProspectsInList
|
|
148
148
|
end
|
149
149
|
```
|
150
150
|
|
151
|
+
### GetEmailsBySocialUrl
|
152
|
+
|
153
|
+
convenience wrapper for `GetEmailsFromUrl` to get a prospect with social url e.g. linkedin profile url
|
154
|
+
|
155
|
+
see https://snov.io/api#GetEmailsFromUrl
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
prospect = Snov::GetEmailsBySocialUrl.new(url: "https://www.linkedin.com/in/john-doe-123456/").prospect
|
159
|
+
|
160
|
+
prospect.data.emails.each do |value|
|
161
|
+
puts value.email
|
162
|
+
puts value.status
|
163
|
+
end
|
164
|
+
|
165
|
+
prospect.data.previous_jobs.each do |value|
|
166
|
+
puts value.company_name
|
167
|
+
puts value.company_type
|
168
|
+
puts value.position
|
169
|
+
puts value.country
|
170
|
+
puts value.start_date
|
171
|
+
puts value.industry
|
172
|
+
puts value.size
|
173
|
+
end
|
174
|
+
|
175
|
+
prospect.data.current_jobs.each do |value|
|
176
|
+
puts value.company_name
|
177
|
+
puts value.company_type
|
178
|
+
puts value.position
|
179
|
+
puts value.country
|
180
|
+
puts value.start_date
|
181
|
+
puts value.industry
|
182
|
+
puts value.size
|
183
|
+
end
|
184
|
+
```
|
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
|
+
```
|
151
200
|
|
152
201
|
## Development
|
153
202
|
|
data/lib/snov.rb
CHANGED
@@ -24,4 +24,6 @@ require 'snov/get_all_prospects_from_list'
|
|
24
24
|
require 'snov/get_prospects_by_email'
|
25
25
|
require 'snov/get_prospect_list'
|
26
26
|
require 'snov/get_user_lists'
|
27
|
+
require 'snov/get_emails_by_social_url'
|
28
|
+
require 'snov/get_emails_from_name'
|
27
29
|
require 'snov/domain_search'
|
data/lib/snov/client.rb
CHANGED
@@ -33,7 +33,7 @@ module Snov
|
|
33
33
|
ERROR_CLASSES = { 401 => UnauthorizedError, 502 => BadGatewayError, 403 => ForbiddenError,
|
34
34
|
504 => GatewayTimeOut, 400 => BadRequest, 405 => MethodNotAllowed }
|
35
35
|
|
36
|
-
def initialize(client_id:, client_secret:, access_token: nil, timeout_seconds:
|
36
|
+
def initialize(client_id:, client_secret:, access_token: nil, timeout_seconds: 90)
|
37
37
|
self.client_id = client_id.to_str
|
38
38
|
self.client_secret = client_secret.to_str
|
39
39
|
@access_token = access_token
|
@@ -67,7 +67,7 @@ module Snov
|
|
67
67
|
def parse_response(resp, path, _params)
|
68
68
|
unless resp.success?
|
69
69
|
error_class = ERROR_CLASSES.fetch(resp.status, ResponseError)
|
70
|
-
raise error_class.new("#{path} (#{resp.status})", response: resp)
|
70
|
+
raise error_class.new("#{path} (#{resp.status})", response: resp&.body)
|
71
71
|
end
|
72
72
|
MultiJson.load(resp.body)
|
73
73
|
end
|
data/lib/snov/fake_client.rb
CHANGED
@@ -46,7 +46,7 @@ module Snov
|
|
46
46
|
def filename(method, path, payload_hash)
|
47
47
|
add = payload_hash.to_a.map { |v| v.join("=") }.join("&").tr(".", "_")
|
48
48
|
add = "default" if add == ""
|
49
|
-
"#{self.class.folder}/#{method}#{path.tr("/", "_")}/#{add}.json"
|
49
|
+
"#{self.class.folder}/#{method}#{path.tr("/", "_")}/#{add.gsub('/', '-')}.json"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Snov
|
2
|
+
class GetEmailsBySocialUrl
|
3
|
+
attr_reader :client
|
4
|
+
|
5
|
+
def initialize(client: Snov.client, url:)
|
6
|
+
@client = client
|
7
|
+
@url = url
|
8
|
+
end
|
9
|
+
|
10
|
+
def prospect
|
11
|
+
@prospect ||= ProspectResult.new(raw_result)
|
12
|
+
end
|
13
|
+
|
14
|
+
def raw_result
|
15
|
+
@raw_result ||= client.post("/v1/get-emails-from-url", "url" => @url)
|
16
|
+
.deep_transform_keys! { |key| key.underscore }
|
17
|
+
end
|
18
|
+
|
19
|
+
class ProspectJob
|
20
|
+
include ActiveModel::Model
|
21
|
+
|
22
|
+
attr_accessor :company_name, :company_type, :position, :social_link, :site, :locality, :state,
|
23
|
+
:city, :street, :street2, :country, :start_date, :end_date, :postal, :founded, :size,
|
24
|
+
:industry
|
25
|
+
end
|
26
|
+
|
27
|
+
class ProspectJobList
|
28
|
+
include ActiveModel::Model
|
29
|
+
include Enumerable
|
30
|
+
|
31
|
+
attr_accessor :jobs
|
32
|
+
|
33
|
+
def each(&block)
|
34
|
+
jobs.each(&block)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class ProspectEmail
|
39
|
+
include ActiveModel::Model
|
40
|
+
|
41
|
+
attr_accessor :email, :status
|
42
|
+
end
|
43
|
+
|
44
|
+
class ProspectData
|
45
|
+
include ActiveModel::Model
|
46
|
+
|
47
|
+
attr_reader :emails, :previous_jobs, :current_jobs
|
48
|
+
attr_accessor :id, :name, :first_name, :last_name, :source_page, :source, :industry,
|
49
|
+
:country, :locality, :last_update_date, :social, :skills, :links
|
50
|
+
|
51
|
+
def emails=(val)
|
52
|
+
@emails = Array.wrap(val).map do |rel|
|
53
|
+
ProspectEmail.new(rel)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def previous_job=(val)
|
58
|
+
@previous_jobs = ProspectJobList.new(jobs: Array.wrap(val).map { |job| ProspectJob.new(job) })
|
59
|
+
end
|
60
|
+
|
61
|
+
def current_job=(val)
|
62
|
+
@current_jobs = ProspectJobList.new(jobs: Array.wrap(val).map { |job| ProspectJob.new(job) })
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class ProspectResult
|
67
|
+
include ActiveModel::Model
|
68
|
+
|
69
|
+
attr_accessor :success, :message
|
70
|
+
attr_reader :data
|
71
|
+
|
72
|
+
def data=(val)
|
73
|
+
@data = ProspectData.new(val)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -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
data/snov.gemspec
CHANGED
@@ -3,18 +3,18 @@ require_relative 'lib/snov/version'
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "snov"
|
5
5
|
spec.version = Snov::VERSION
|
6
|
-
spec.authors = ["Grant Petersen-Speelman"]
|
7
|
-
spec.email = ["grantspeelman@gmail.com"]
|
6
|
+
spec.authors = ["Grant Petersen-Speelman", "Bapu Sethi"]
|
7
|
+
spec.email = ["grantspeelman@gmail.com", "bapu.sethi.03@gmail.com"]
|
8
8
|
spec.license = "MIT"
|
9
9
|
|
10
10
|
spec.summary = %q{Snov client to interact with snov api}
|
11
11
|
spec.description = %q{Snov client to interact with snov api}
|
12
12
|
spec.homepage = "https://github.com/NEXL-LTS/snov-ruby"
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
14
14
|
|
15
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
16
16
|
spec.metadata["source_code_uri"] = "https://github.com/NEXL-LTS/snov-ruby"
|
17
|
-
spec.metadata["changelog_uri"] = "https://github.com/NEXL-LTS/snov-ruby/CHANGELOG.md"
|
17
|
+
spec.metadata["changelog_uri"] = "https://github.com/NEXL-LTS/snov-ruby/blob/main/CHANGELOG.md"
|
18
18
|
|
19
19
|
# Specify which files should be added to the gem when it is released.
|
20
20
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Petersen-Speelman
|
8
|
-
|
8
|
+
- Bapu Sethi
|
9
|
+
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2021-
|
12
|
+
date: 2021-06-18 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activemodel
|
@@ -113,10 +114,12 @@ dependencies:
|
|
113
114
|
description: Snov client to interact with snov api
|
114
115
|
email:
|
115
116
|
- grantspeelman@gmail.com
|
117
|
+
- bapu.sethi.03@gmail.com
|
116
118
|
executables: []
|
117
119
|
extensions: []
|
118
120
|
extra_rdoc_files: []
|
119
121
|
files:
|
122
|
+
- ".byebug_history"
|
120
123
|
- ".gitignore"
|
121
124
|
- ".rspec"
|
122
125
|
- ".rubocop.yml"
|
@@ -141,10 +144,12 @@ files:
|
|
141
144
|
- lib/snov/fake_client/post_v1_get-profile-by-email/not_found=true.json
|
142
145
|
- lib/snov/fake_client/post_v1_get-prospects-by-email/email=gavin_vanrooyen@octagon_com.json
|
143
146
|
- lib/snov/fake_client/post_v1_get-prospects-by-email/not_found=true.json
|
144
|
-
- lib/snov/fake_client/post_v1_prospect-list/
|
145
|
-
- lib/snov/fake_client/post_v1_prospect-list/
|
146
|
-
- lib/snov/fake_client/post_v1_prospect-list/
|
147
|
+
- lib/snov/fake_client/post_v1_prospect-list/listId=1479070&page=1&perPage=100.json
|
148
|
+
- lib/snov/fake_client/post_v1_prospect-list/listId=1505383&page=1&perPage=100.json
|
149
|
+
- lib/snov/fake_client/post_v1_prospect-list/listId=1818597&page=1&perPage=100.json
|
147
150
|
- lib/snov/get_all_prospects_from_list.rb
|
151
|
+
- lib/snov/get_emails_by_social_url.rb
|
152
|
+
- lib/snov/get_emails_from_name.rb
|
148
153
|
- lib/snov/get_profile_by_email.rb
|
149
154
|
- lib/snov/get_prospect_list.rb
|
150
155
|
- lib/snov/get_prospects_by_email.rb
|
@@ -158,8 +163,8 @@ licenses:
|
|
158
163
|
metadata:
|
159
164
|
homepage_uri: https://github.com/NEXL-LTS/snov-ruby
|
160
165
|
source_code_uri: https://github.com/NEXL-LTS/snov-ruby
|
161
|
-
changelog_uri: https://github.com/NEXL-LTS/snov-ruby/CHANGELOG.md
|
162
|
-
post_install_message:
|
166
|
+
changelog_uri: https://github.com/NEXL-LTS/snov-ruby/blob/main/CHANGELOG.md
|
167
|
+
post_install_message:
|
163
168
|
rdoc_options: []
|
164
169
|
require_paths:
|
165
170
|
- lib
|
@@ -167,15 +172,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
172
|
requirements:
|
168
173
|
- - ">="
|
169
174
|
- !ruby/object:Gem::Version
|
170
|
-
version: 2.
|
175
|
+
version: 2.5.0
|
171
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
177
|
requirements:
|
173
178
|
- - ">="
|
174
179
|
- !ruby/object:Gem::Version
|
175
180
|
version: '0'
|
176
181
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
178
|
-
signing_key:
|
182
|
+
rubygems_version: 3.2.15
|
183
|
+
signing_key:
|
179
184
|
specification_version: 4
|
180
185
|
summary: Snov client to interact with snov api
|
181
186
|
test_files: []
|