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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5649b149285da261df828fc1faa48468ddba599a
4
- data.tar.gz: 953e44628f3ad974a8930ca1792905aac18d1dbe
2
+ SHA256:
3
+ metadata.gz: d9cca816b859af71470e2f574c274e195f40957e90a2824874f6f674a39d0198
4
+ data.tar.gz: a77dff70b14ff58e51da7ba5593aa6b224dcfed6f15da4781a77c0e77ed4ff49
5
5
  SHA512:
6
- metadata.gz: aa4d396e04403eed1c426cdba4dd861f5cc37d6c85613db4c8b1af308098d091c1ec127fc934d04cc73beaa998c567ff2886ca2e78db65da0d8095fd61b11e86
7
- data.tar.gz: 0d4892f947e75fe9ff8d21b8a41e5e9de4bfb80c9751d77136a96e1e49bb056df55d206218f3616d9a92b05f426441788381260f25ab2d3cd107b355db1e45c0
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://emailhunter.co
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 "bundler/gem_tasks"
2
-
1
+ require 'bundler/gem_tasks'
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "emailhunter"
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 "irb"
13
+ require 'irb'
14
14
  IRB.start
data/emailhunter.gemspec CHANGED
@@ -1,32 +1,30 @@
1
- # coding: utf-8
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('../lib/email_hunter/version', __FILE__)
3
+ require File.expand_path('lib/email_hunter/version', __dir__)
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "emailhunter"
6
+ spec.name = 'emailhunter'
8
7
  spec.version = EmailHunter::VERSION
9
- spec.authors = ["Davide Santangelo"]
10
- spec.email = ["davide.santangelo@gmail.com"]
8
+ spec.authors = ['Davide Santangelo']
9
+ spec.email = ['davide.santangelo@gmail.com']
11
10
 
12
-
13
- spec.summary = %q{A tiny ruby wrapper around Email Hunter API }
14
- spec.description = %q{A tiny ruby wrapper around Email Hunter API. Email Hunter helps sales people reach their targets and increase their sales. }
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 = "exe"
16
+ spec.bindir = 'exe'
19
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
18
+ spec.require_paths = ['lib']
21
19
 
22
- spec.add_development_dependency "bundler", "~> 1.8"
23
- spec.add_development_dependency "rake", "~> 10.0"
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 "vcr"
26
- spec.add_development_dependency "typhoeus"
23
+ spec.add_development_dependency 'typhoeus'
24
+ spec.add_development_dependency 'vcr'
27
25
 
28
- spec.required_ruby_version = ">= 1.9.3"
26
+ spec.required_ruby_version = '>= 1.9.3'
29
27
 
30
- spec.add_dependency "faraday"
31
- spec.add_dependency "json"
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
- extend self
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
@@ -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
- def initialize(key)
14
- @key = key
15
- end
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, self.key, params).hunt
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, self.key).hunt
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, self.key).hunt
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, self.key).hunt
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
@@ -1,7 +1,7 @@
1
1
  require 'faraday'
2
2
  require 'json'
3
3
 
4
- API_COUNT_URL = 'https://api.emailhunter.co/v2/email-count?'
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
- 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}) : []
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
@@ -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
- url = URI.parse(URI.encode("#{API_EXIST_URL}email=#{@email}&api_key=#{@key}"))
24
- response = Faraday.new(url).get
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
@@ -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
- url = URI.parse(URI.encode("#{API_FINDER_URL}domain=#{@domain}&first_name=#{@first_name}&last_name=#{@last_name}&api_key=#{@key}"))
26
- response = Faraday.new(url).get
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
@@ -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.emailhunter.co/v2/domain-search?'
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
- url =
25
- URI.parse(URI.encode(
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
@@ -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.emailhunter.co/v2/email-verifier?'
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
- url = URI.parse(URI.encode("#{API_VERIFY_URL}email=#{@email}&api_key=#{@key}"))
24
- response = Faraday.new(url).get
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EmailHunter
2
- VERSION = "0.7.0"
4
+ VERSION = '0.9.0'
3
5
  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.7.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: 2016-12-02 00:00:00.000000000 Z
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: vcr
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: typhoeus
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 Email Hunter API. Email Hunter helps sales
112
- people reach their targets and increase their sales. '
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
- rubyforge_project:
159
- rubygems_version: 2.6.8
160
- signing_key:
159
+ rubygems_version: 3.0.8
160
+ signing_key:
161
161
  specification_version: 4
162
- summary: A tiny ruby wrapper around Email Hunter API
162
+ summary: A tiny ruby wrapper around Hunter.io API
163
163
  test_files: []