emailhunter 0.7.1 → 0.8.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: a0a7a357d1a9dd42a23bb6af0e8c1b1f6d7cc365
4
- data.tar.gz: 5ce12facae168b1896a27c455cafbb8c23d0ce1d
2
+ SHA256:
3
+ metadata.gz: a874f0d9d9c2cb972daf51e46bb06f3635956577482f3d7ce52aac34d1f336ae
4
+ data.tar.gz: b579502b7f44f449a8df51ec604e04b25a5268149ffd4bfec6af64af03eeb0d2
5
5
  SHA512:
6
- metadata.gz: 179f292846bcbb83e56cdf008f739e473ecb52c730a89db459eeb49bb09c20795b66dc7eebd9f47c006fd5c6a8e7581c29b7fb6046a43c123069774da2c82789
7
- data.tar.gz: 4ec17e01021a59e42821290b6895da9b78488dd664ced8b52052ad133cbed5e4b097524de756e94a26e327ea70811e5ed54d3b7462474e29730580354379a205
6
+ metadata.gz: 82480b37bf3bea964b41c014dd4f73c4bd04022238bdee404077d448fac83a664c25314cf014c5b93ce44d7f39d621df5ea711a3152868c0a7999ef82eac13fa
7
+ data.tar.gz: c15f4cfc1fe641446c2b0aacf0862327f3f1568bf791cc77c27165c518ab7a2a67b810e3058ea0b9b6f946b0d3c481677abb6d0b9166c149fbeddfaebdf587e5
data/README.md CHANGED
@@ -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
 
@@ -0,0 +1,27 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ API_VERIFY_URL = 'https://api.hunter.io/v2/account?'
5
+
6
+ module EmailHunter
7
+ class Account
8
+ attr_reader :result, :first_name, :last_name, :email, :plan_name, :plan_level, :reset_date, :team_id, :calls
9
+
10
+ def initialize(key)
11
+ @key = key
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_VERIFY_URL}&api_key=#{@key}"))
23
+ response = Faraday.new(url).get
24
+ response.success? ? JSON.parse(response.body, {symbolize_names: true}) : []
25
+ end
26
+ end
27
+ end
@@ -5,6 +5,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'search'))
5
5
  require File.expand_path(File.join(File.dirname(__FILE__), 'finder'))
6
6
  require File.expand_path(File.join(File.dirname(__FILE__), 'verify'))
7
7
  require File.expand_path(File.join(File.dirname(__FILE__), 'count'))
8
+ require File.expand_path(File.join(File.dirname(__FILE__), 'account'))
8
9
 
9
10
  module EmailHunter
10
11
  class Api
@@ -34,8 +35,14 @@ module EmailHunter
34
35
  EmailHunter::Finder.new(domain, first_name, last_name, self.key).hunt
35
36
  end
36
37
 
38
+ # Email Count API
37
39
  def count(domain)
38
40
  EmailHunter::Count.new(domain).hunt
39
41
  end
42
+
43
+ # Account Information API
44
+ def account
45
+ EmailHunter::Account.new(self.key).hunt
46
+ end
40
47
  end
41
48
  end
@@ -1,3 +1,3 @@
1
1
  module EmailHunter
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8.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.7.1
4
+ version: 0.8.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: 2018-09-10 00:00:00.000000000 Z
11
+ date: 2019-06-04 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
  - 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
@@ -155,8 +156,7 @@ 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.10
159
+ rubygems_version: 3.0.2
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: A tiny ruby wrapper around Email Hunter API