emailhunter 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +68 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/emailhunter.gemspec +32 -0
- data/lib/email_hunter.rb +10 -0
- data/lib/email_hunter/api.rb +20 -0
- data/lib/email_hunter/exist.rb +28 -0
- data/lib/email_hunter/search.rb +29 -0
- data/lib/email_hunter/version.rb +3 -0
- data/lib/emailhunter.rb +1 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: da0351f07c47ddebc583de5f89870a109ca3d4c4
|
4
|
+
data.tar.gz: 40285db85906704a1c892a6d1dfa895780382352
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d70a2428ffa0ebd03dd44fb9fbd8b92d0da957d804eb7d212142ed4e853cd8b94eec478e80c345cb9485c1427de4a564ddb6c473098a57814d5e640fbf998a2f
|
7
|
+
data.tar.gz: f9ec3fc53a8411b2ea441bda110595e849a45aaf7d019ab19d9eb13eb9968cc26d684a241b61d78ca0095b2212f925e47130d18a13db5399ef4bf3e0f64ad164
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Davide Santangelo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Emailhunter
|
2
|
+
|
3
|
+
A tiny ruby wrapper around Email Hunter API
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'emailhunter'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install emailhunter
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'emailhunter'
|
25
|
+
email = EmailHunter.new('Your secret API key')
|
26
|
+
|
27
|
+
```
|
28
|
+
Your secret API key. You can generate it in your dashboard from https://emailhunter.co
|
29
|
+
|
30
|
+
## Domain search API
|
31
|
+
Get the list of all the emails from a given domain name. Each email is returned with our source(s), its type (generic or personnal) and the date it was extracted on
|
32
|
+
```ruby
|
33
|
+
result = email.search('stripe.com')
|
34
|
+
```
|
35
|
+
|
36
|
+
## Accessing domain search response
|
37
|
+
```ruby
|
38
|
+
result.status
|
39
|
+
result.results
|
40
|
+
result.emails
|
41
|
+
```
|
42
|
+
|
43
|
+
|
44
|
+
## Email check API
|
45
|
+
Find if a given email exist. If it does, we'll return where it was found.
|
46
|
+
```ruby
|
47
|
+
email.exist('bonjour@firmapi.com')
|
48
|
+
```
|
49
|
+
|
50
|
+
## Accessing email check response
|
51
|
+
```ruby
|
52
|
+
result.status
|
53
|
+
result.email
|
54
|
+
result.exist
|
55
|
+
result.sources
|
56
|
+
```
|
57
|
+
|
58
|
+
## License
|
59
|
+
The restcountry GEM is released under the MIT License.
|
60
|
+
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
1. Fork it ( https://github.com/[my-github-username]/emailhunter/fork )
|
65
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
66
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
67
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
68
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "emailhunter"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/emailhunter.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require File.expand_path('../lib/email_hunter/version', __FILE__)
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "emailhunter"
|
8
|
+
spec.version = EmailHunter::VERSION
|
9
|
+
spec.authors = ["Davide Santangelo"]
|
10
|
+
spec.email = ["davide.santangelo@gmail.com"]
|
11
|
+
|
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 }
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency 'rspec'
|
25
|
+
spec.add_development_dependency "vcr"
|
26
|
+
spec.add_development_dependency "typhoeus"
|
27
|
+
|
28
|
+
spec.required_ruby_version = ">= 1.9.3"
|
29
|
+
|
30
|
+
spec.add_dependency "faraday"
|
31
|
+
spec.add_dependency "json"
|
32
|
+
end
|
data/lib/email_hunter.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'search'))
|
4
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'exist'))
|
5
|
+
|
6
|
+
module EmailHunter
|
7
|
+
class Api
|
8
|
+
def initialize(key)
|
9
|
+
@key = key
|
10
|
+
end
|
11
|
+
|
12
|
+
def search(domain)
|
13
|
+
EmailHunter::Search.new(domain, @key).hunt
|
14
|
+
end
|
15
|
+
|
16
|
+
def exist(email)
|
17
|
+
EmailHunter::Exist.new(email, @key).hunt
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
API_EXISTS_URL = 'https://api.emailhunter.co/v1/exist?'
|
5
|
+
|
6
|
+
module EmailHunter
|
7
|
+
class Exist
|
8
|
+
attr_reader :status, :email, :exist, :sources
|
9
|
+
|
10
|
+
def initialize(email, key)
|
11
|
+
@email = email
|
12
|
+
@key = key
|
13
|
+
end
|
14
|
+
|
15
|
+
def hunt
|
16
|
+
response = apiresponse
|
17
|
+
OpenStruct.new(response) unless response.empty?
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def apiresponse
|
23
|
+
url = "#{API_EXISTS_URL}email=#{@email}&api_key=#{@key}"
|
24
|
+
response = Faraday.get(URI.parse(URI.encode(url)))
|
25
|
+
response.success? ? JSON.parse(response.body) : []
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'ostruct'
|
4
|
+
|
5
|
+
API_SEARCH_URL = 'https://api.emailhunter.co/v1/search?'
|
6
|
+
|
7
|
+
module EmailHunter
|
8
|
+
class Search
|
9
|
+
attr_reader :status, :results, :emails
|
10
|
+
|
11
|
+
def initialize(domain, key)
|
12
|
+
@domain = domain
|
13
|
+
@key = key
|
14
|
+
end
|
15
|
+
|
16
|
+
def hunt
|
17
|
+
response = apiresponse
|
18
|
+
OpenStruct.new(response) unless response.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def apiresponse
|
24
|
+
url = "#{API_SEARCH_URL}domain=#{@domain}&api_key=#{@key}"
|
25
|
+
response = Faraday.get(URI.parse(URI.encode(url)))
|
26
|
+
response.success? ? JSON.parse(response.body) : []
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/emailhunter.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), './email_hunter'))
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: emailhunter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Davide Santangelo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: vcr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: typhoeus
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faraday
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: json
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: 'A tiny ruby wrapper around Email Hunter API '
|
112
|
+
email:
|
113
|
+
- davide.santangelo@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".travis.yml"
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bin/console
|
126
|
+
- bin/setup
|
127
|
+
- emailhunter.gemspec
|
128
|
+
- lib/email_hunter.rb
|
129
|
+
- lib/email_hunter/api.rb
|
130
|
+
- lib/email_hunter/exist.rb
|
131
|
+
- lib/email_hunter/search.rb
|
132
|
+
- lib/email_hunter/version.rb
|
133
|
+
- lib/emailhunter.rb
|
134
|
+
homepage:
|
135
|
+
licenses:
|
136
|
+
- MIT
|
137
|
+
metadata: {}
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 1.9.3
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.4.6
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: A tiny ruby wrapper around Email Hunter API
|
158
|
+
test_files: []
|