emailhunter 0.5.0 → 0.6.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
  SHA1:
3
- metadata.gz: 8f06bb3c5d21ec48256f0a9060a8f5104a43a23f
4
- data.tar.gz: a6a59d6a5524be03c74843546b9d684959727619
3
+ metadata.gz: 6253d641337b4e60eba9a4f104f23a1043b4215f
4
+ data.tar.gz: 645f662f4ad60db251f642bfabcdfb50a7223d4c
5
5
  SHA512:
6
- metadata.gz: 814f17babd817bc4705fc7f0149f21a2d12f92f2e94574f2a9b8ac5260d58efc3ae3e93d451524a298a8074aa27808b3d8f41e01952e9999d71bbcddf7e2cd96
7
- data.tar.gz: 9d2ae97e5e2b590d2bb9ec6e04cc1f242f2fed97ac18fb00a103806e1654c40e022e9e0a2ce2c58a5a12dc22355aa9fd4fbe39ea480b7bed31463c0748df555b
6
+ metadata.gz: 4f6aa7e7d2a1add576bd974192766e3cb0328f3b90ddcd91ae6dfb238af6c788a553665a84b6806bd1bff58eaacb5e58672292a66173122e78b749f56367efbe
7
+ data.tar.gz: ec2fd520126b3113320567510983740429d127f202ddae6fe93b004e3de385477ef6eaf2c1ba5ae607df6113a1633395e5e0612444f996a4c1f519920641c362
data/README.md CHANGED
@@ -64,7 +64,25 @@ result.accept_all
64
64
  result.sources
65
65
  ```
66
66
 
67
- ## Generate API
67
+ ## Email Exist API
68
+ This API call is deprecated, please use the email verification call instead.
69
+
70
+
71
+ This API endpoint allows you to check if a given email address has been found on the web. If it has been found, it returns all the sources with the dates of the last crawls.
72
+
73
+ ```ruby
74
+ email_hunter.exist('bonjour@firmapi.com')
75
+ ```
76
+
77
+ ## Accessing email verify response
78
+ ```ruby
79
+ result.status
80
+ result.email
81
+ result.exist
82
+ result.sources
83
+ ```
84
+
85
+ ## Generate API
68
86
  Guesses the most likely email of a person from his first name, his last name and a domain name.
69
87
  ```ruby
70
88
  email_hunter.generate('gmail.com', 'Davide', 'Santangelo')
@@ -77,6 +95,18 @@ result.email
77
95
  result.score
78
96
  ```
79
97
 
98
+ ## Count API
99
+ Returns the number of email addresses found for a domain. This is a FREE API call.
100
+ ```ruby
101
+ email_hunter.count('gmail.com')
102
+ ```
103
+
104
+ ## Accessing count response
105
+ ```ruby
106
+ result.status
107
+ result.count
108
+ ```
109
+
80
110
  ## License
81
111
  The emailhunter GEM is released under the MIT License.
82
112
 
@@ -1,8 +1,10 @@
1
1
  require 'uri'
2
2
 
3
+ require File.expand_path(File.join(File.dirname(__FILE__), 'exist'))
3
4
  require File.expand_path(File.join(File.dirname(__FILE__), 'search'))
4
5
  require File.expand_path(File.join(File.dirname(__FILE__), 'generate'))
5
6
  require File.expand_path(File.join(File.dirname(__FILE__), 'verify'))
7
+ require File.expand_path(File.join(File.dirname(__FILE__), 'count'))
6
8
 
7
9
  module EmailHunter
8
10
  class Api
@@ -32,8 +34,8 @@ module EmailHunter
32
34
  EmailHunter::Generate.new(domain, first_name, last_name, self.key).hunt
33
35
  end
34
36
 
35
- def verify(email)
36
- EmailHunter::Verify.new(email, self.key).hunt
37
+ def count(domain)
38
+ EmailHunter::Count.new(domain).hunt
37
39
  end
38
40
  end
39
41
  end
@@ -0,0 +1,27 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ API_COUNT_URL = 'https://api.emailhunter.co/v1/email-count?'
5
+
6
+ module EmailHunter
7
+ class Count
8
+ attr_reader :status, :count
9
+
10
+ def initialize(domain)
11
+ @domain = domain
12
+ end
13
+
14
+ def hunt
15
+ response = apiresponse
16
+ Struct.new(*response.keys).new(*response.values) unless response.empty?
17
+ end
18
+
19
+ private
20
+
21
+ def apiresponse
22
+ url = URI.parse(URI.encode("#{API_COUNT_URL}domain=#{@domain}"))
23
+ response = Faraday.new(url).get
24
+ response.success? ? JSON.parse(response.body, {symbolize_names: true}) : []
25
+ end
26
+ end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module EmailHunter
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide Santangelo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-30 00:00:00.000000000 Z
11
+ date: 2016-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,6 +128,7 @@ files:
128
128
  - emailhunter.gemspec
129
129
  - lib/email_hunter.rb
130
130
  - lib/email_hunter/api.rb
131
+ - lib/email_hunter/count.rb
131
132
  - lib/email_hunter/exist.rb
132
133
  - lib/email_hunter/generate.rb
133
134
  - lib/email_hunter/search.rb