emailhunter 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +31 -2
- data/Rakefile +1 -2
- data/bin/console +3 -3
- data/emailhunter.gemspec +17 -19
- data/lib/email_hunter.rb +3 -1
- data/lib/email_hunter/account.rb +28 -0
- data/lib/email_hunter/api.rb +16 -7
- data/lib/email_hunter/count.rb +3 -4
- data/lib/email_hunter/exist.rb +4 -3
- data/lib/email_hunter/finder.rb +5 -4
- data/lib/email_hunter/search.rb +5 -7
- data/lib/email_hunter/verify.rb +5 -4
- data/lib/email_hunter/version.rb +3 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d9cca816b859af71470e2f574c274e195f40957e90a2824874f6f674a39d0198
|
4
|
+
data.tar.gz: a77dff70b14ff58e51da7ba5593aa6b224dcfed6f15da4781a77c0e77ed4ff49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b890e80434096d88af8414aaa387a28d1ff0afbbdc177eddd8284e191092d8335b06c50d874bbc48c23e5d80271b289db98ad85c63c5664e0819f90e3545227
|
7
|
+
data.tar.gz: fab3c8de09ef1c3ae7ad59c82519422123982e3f996d9b53b5f65bd6b7cb15e98139542d5541b2f6e289f394772b996a141bf89e01528c46a9934bb10ad42200
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Emailhunter
|
2
2
|
|
3
|
-
A tiny ruby wrapper around Email Hunter API. Direct access to all the web's email addresses.
|
3
|
+
A tiny ruby wrapper around Hunter (former Email Hunter) API. Direct access to all the web's email addresses.
|
4
4
|
|
5
5
|
UPDATE (2016-12-02): gem updated with V2 API.
|
6
6
|
|
@@ -27,7 +27,7 @@ require 'emailhunter'
|
|
27
27
|
email_hunter = EmailHunter.new('Your secret API key')
|
28
28
|
|
29
29
|
```
|
30
|
-
Your secret API key. You can generate it in your dashboard from https://
|
30
|
+
Your secret API key. You can generate it in your dashboard from https://hunter.io
|
31
31
|
|
32
32
|
## Domain search API
|
33
33
|
Returns all the email addresses found using one given domain name, with our sources.
|
@@ -109,6 +109,35 @@ result.fetch(:data)
|
|
109
109
|
result.fetch(:meta)
|
110
110
|
```
|
111
111
|
|
112
|
+
## Account Information
|
113
|
+
This method enables you to get information regarding your Hunter account at any time. This call is free.
|
114
|
+
```ruby
|
115
|
+
email_hunter.account
|
116
|
+
```
|
117
|
+
|
118
|
+
## Accessing account response
|
119
|
+
```ruby
|
120
|
+
result.fetch(:data)
|
121
|
+
```
|
122
|
+
|
123
|
+
```json
|
124
|
+
{
|
125
|
+
"data":{
|
126
|
+
"first_name":"Davide",
|
127
|
+
"last_name":"Santangelo",
|
128
|
+
"email":"davide.santangelo@gmail.com",
|
129
|
+
"plan_name":"Free",
|
130
|
+
"plan_level":0,
|
131
|
+
"reset_date":"2019-06-29",
|
132
|
+
"team_id":349,
|
133
|
+
"calls":{
|
134
|
+
"used":4,
|
135
|
+
"available":50
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
```
|
140
|
+
|
112
141
|
## License
|
113
142
|
The emailhunter GEM is released under the MIT License.
|
114
143
|
|
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'emailhunter'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "emailhunter"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/emailhunter.gemspec
CHANGED
@@ -1,32 +1,30 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require File.expand_path('
|
3
|
+
require File.expand_path('lib/email_hunter/version', __dir__)
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
6
|
+
spec.name = 'emailhunter'
|
8
7
|
spec.version = EmailHunter::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
8
|
+
spec.authors = ['Davide Santangelo']
|
9
|
+
spec.email = ['davide.santangelo@gmail.com']
|
11
10
|
|
12
|
-
|
13
|
-
spec.
|
14
|
-
spec.
|
15
|
-
spec.license = "MIT"
|
11
|
+
spec.summary = 'A tiny ruby wrapper around Hunter.io API '
|
12
|
+
spec.description = 'A tiny ruby wrapper around Hunter.io API. Hunter.io helps sales people reach their targets and increase their sales. '
|
13
|
+
spec.license = 'MIT'
|
16
14
|
|
17
15
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
16
|
+
spec.bindir = 'exe'
|
19
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
18
|
+
spec.require_paths = ['lib']
|
21
19
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.8'
|
21
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
22
|
spec.add_development_dependency 'rspec'
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
23
|
+
spec.add_development_dependency 'typhoeus'
|
24
|
+
spec.add_development_dependency 'vcr'
|
27
25
|
|
28
|
-
spec.required_ruby_version =
|
26
|
+
spec.required_ruby_version = '>= 1.9.3'
|
29
27
|
|
30
|
-
spec.add_dependency
|
31
|
-
spec.add_dependency
|
28
|
+
spec.add_dependency 'faraday'
|
29
|
+
spec.add_dependency 'json'
|
32
30
|
end
|
data/lib/email_hunter.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path(File.join(File.dirname(__FILE__), 'email_hunter/api'))
|
2
4
|
require File.expand_path(File.join(File.dirname(__FILE__), 'email_hunter/version'))
|
3
5
|
|
4
6
|
module EmailHunter
|
5
|
-
|
7
|
+
module_function
|
6
8
|
|
7
9
|
def new(key)
|
8
10
|
Api.new(key)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
API_ACCOUNT_URL = 'https://api.hunter.io/v2/account?'
|
7
|
+
|
8
|
+
module EmailHunter
|
9
|
+
class Account
|
10
|
+
attr_reader :result, :first_name, :last_name, :email, :plan_name, :plan_level, :reset_date, :team_id, :calls, :requests
|
11
|
+
|
12
|
+
def initialize(key)
|
13
|
+
@key = key
|
14
|
+
end
|
15
|
+
|
16
|
+
def hunt
|
17
|
+
response = apiresponse
|
18
|
+
Struct.new(*response.keys).new(*response.values) unless response.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def apiresponse
|
24
|
+
response = Faraday.new("#{API_ACCOUNT_URL}&api_key=#{@key}").get
|
25
|
+
response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/email_hunter/api.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'uri'
|
2
4
|
|
3
5
|
require File.expand_path(File.join(File.dirname(__FILE__), 'exist'))
|
@@ -5,37 +7,44 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'search'))
|
|
5
7
|
require File.expand_path(File.join(File.dirname(__FILE__), 'finder'))
|
6
8
|
require File.expand_path(File.join(File.dirname(__FILE__), 'verify'))
|
7
9
|
require File.expand_path(File.join(File.dirname(__FILE__), 'count'))
|
10
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'account'))
|
8
11
|
|
9
12
|
module EmailHunter
|
10
13
|
class Api
|
11
14
|
attr_reader :key
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
def initialize(key)
|
17
|
+
@key = key
|
18
|
+
end
|
16
19
|
|
17
20
|
# Domain search API
|
18
21
|
def search(domain, params = {})
|
19
|
-
EmailHunter::Search.new(domain,
|
22
|
+
EmailHunter::Search.new(domain, key, params).hunt
|
20
23
|
end
|
21
24
|
|
22
25
|
# Email exist API
|
23
26
|
def exist(email)
|
24
|
-
EmailHunter::Exist.new(email,
|
27
|
+
EmailHunter::Exist.new(email, key).hunt
|
25
28
|
end
|
26
29
|
|
27
30
|
# Email verify API
|
28
31
|
def verify(email)
|
29
|
-
EmailHunter::Verify.new(email,
|
32
|
+
EmailHunter::Verify.new(email, key).hunt
|
30
33
|
end
|
31
34
|
|
32
35
|
# Email Finder API
|
33
36
|
def finder(domain, first_name, last_name)
|
34
|
-
EmailHunter::Finder.new(domain, first_name, last_name,
|
37
|
+
EmailHunter::Finder.new(domain, first_name, last_name, key).hunt
|
35
38
|
end
|
36
39
|
|
40
|
+
# Email Count API
|
37
41
|
def count(domain)
|
38
42
|
EmailHunter::Count.new(domain).hunt
|
39
43
|
end
|
44
|
+
|
45
|
+
# Account Information API
|
46
|
+
def account
|
47
|
+
EmailHunter::Account.new(key).hunt
|
48
|
+
end
|
40
49
|
end
|
41
50
|
end
|
data/lib/email_hunter/count.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
API_COUNT_URL = 'https://api.
|
4
|
+
API_COUNT_URL = 'https://api.hunter.io/v2/email-count?'.freeze
|
5
5
|
|
6
6
|
module EmailHunter
|
7
7
|
class Count
|
@@ -19,9 +19,8 @@ module EmailHunter
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def apiresponse
|
22
|
-
|
23
|
-
response
|
24
|
-
response.success? ? JSON.parse(response.body, {symbolize_names: true}) : []
|
22
|
+
response = Faraday.new("#{API_COUNT_URL}domain=#{@domain}").get
|
23
|
+
response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
data/lib/email_hunter/exist.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'json'
|
3
5
|
|
@@ -20,9 +22,8 @@ module EmailHunter
|
|
20
22
|
private
|
21
23
|
|
22
24
|
def apiresponse
|
23
|
-
|
24
|
-
response
|
25
|
-
response.success? ? JSON.parse(response.body, {symbolize_names: true}) : []
|
25
|
+
response = Faraday.new("#{API_EXIST_URL}email=#{@email}&api_key=#{@key}").get
|
26
|
+
response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
data/lib/email_hunter/finder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'json'
|
3
5
|
|
@@ -22,9 +24,8 @@ module EmailHunter
|
|
22
24
|
private
|
23
25
|
|
24
26
|
def apiresponse
|
25
|
-
|
26
|
-
response
|
27
|
-
response.success? ? JSON.parse(response.body, {symbolize_names: true}) : []
|
27
|
+
response = Faraday.new("#{API_FINDER_URL}domain=#{@domain}&first_name=#{@first_name}&last_name=#{@last_name}&api_key=#{@key}").get
|
28
|
+
response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
|
28
29
|
end
|
29
30
|
end
|
30
|
-
end
|
31
|
+
end
|
data/lib/email_hunter/search.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'json'
|
3
5
|
|
4
|
-
API_SEARCH_URL = 'https://api.
|
6
|
+
API_SEARCH_URL = 'https://api.hunter.io/v2/domain-search?'
|
5
7
|
|
6
8
|
module EmailHunter
|
7
9
|
class Search
|
@@ -21,12 +23,8 @@ module EmailHunter
|
|
21
23
|
private
|
22
24
|
|
23
25
|
def apiresponse
|
24
|
-
|
25
|
-
|
26
|
-
"#{API_SEARCH_URL}domain=#{@domain}&api_key=#{@key}&type=#{@params[:type]}&offset=#{@params[:offset]}")
|
27
|
-
)
|
28
|
-
response = Faraday.new(url).get
|
29
|
-
response.success? ? JSON.parse(response.body, {symbolize_names: true}) : []
|
26
|
+
response = Faraday.new("#{API_SEARCH_URL}domain=#{@domain}&api_key=#{@key}&type=#{@params[:type]}&offset=#{@params[:offset]}&limit=#{@params[:limit]}").get
|
27
|
+
response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
data/lib/email_hunter/verify.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'json'
|
3
5
|
|
4
|
-
API_VERIFY_URL = 'https://api.
|
6
|
+
API_VERIFY_URL = 'https://api.hunter.io/v2/email-verifier?'
|
5
7
|
|
6
8
|
module EmailHunter
|
7
9
|
class Verify
|
@@ -20,9 +22,8 @@ module EmailHunter
|
|
20
22
|
private
|
21
23
|
|
22
24
|
def apiresponse
|
23
|
-
|
24
|
-
response
|
25
|
-
response.success? ? JSON.parse(response.body, {symbolize_names: true}) : []
|
25
|
+
response = Faraday.new("#{API_VERIFY_URL}email=#{@email}&api_key=#{@key}").get
|
26
|
+
response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
data/lib/email_hunter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emailhunter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davide Santangelo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: typhoeus
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: vcr
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -108,8 +108,8 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description: 'A tiny ruby wrapper around
|
112
|
-
|
111
|
+
description: 'A tiny ruby wrapper around Hunter.io API. Hunter.io helps sales people
|
112
|
+
reach their targets and increase their sales. '
|
113
113
|
email:
|
114
114
|
- davide.santangelo@gmail.com
|
115
115
|
executables: []
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- bin/setup
|
129
129
|
- emailhunter.gemspec
|
130
130
|
- lib/email_hunter.rb
|
131
|
+
- lib/email_hunter/account.rb
|
131
132
|
- lib/email_hunter/api.rb
|
132
133
|
- lib/email_hunter/count.rb
|
133
134
|
- lib/email_hunter/exist.rb
|
@@ -136,11 +137,11 @@ files:
|
|
136
137
|
- lib/email_hunter/verify.rb
|
137
138
|
- lib/email_hunter/version.rb
|
138
139
|
- lib/emailhunter.rb
|
139
|
-
homepage:
|
140
|
+
homepage:
|
140
141
|
licenses:
|
141
142
|
- MIT
|
142
143
|
metadata: {}
|
143
|
-
post_install_message:
|
144
|
+
post_install_message:
|
144
145
|
rdoc_options: []
|
145
146
|
require_paths:
|
146
147
|
- lib
|
@@ -155,9 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
156
|
- !ruby/object:Gem::Version
|
156
157
|
version: '0'
|
157
158
|
requirements: []
|
158
|
-
|
159
|
-
|
160
|
-
signing_key:
|
159
|
+
rubygems_version: 3.0.8
|
160
|
+
signing_key:
|
161
161
|
specification_version: 4
|
162
|
-
summary: A tiny ruby wrapper around
|
162
|
+
summary: A tiny ruby wrapper around Hunter.io API
|
163
163
|
test_files: []
|