hunterio 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +9 -0
 - data/.rspec +2 -0
 - data/.travis.yml +3 -0
 - data/Gemfile +4 -0
 - data/LICENSE +21 -0
 - data/README.md +108 -0
 - data/Rakefile +2 -0
 - data/bin/console +14 -0
 - data/bin/setup +7 -0
 - data/hunter.gemspec +33 -0
 - data/lib/hunter.rb +10 -0
 - data/lib/hunter/api.rb +35 -0
 - data/lib/hunter/domain_search.rb +35 -0
 - data/lib/hunter/email_count.rb +30 -0
 - data/lib/hunter/email_finder.rb +33 -0
 - data/lib/hunter/email_verifier.rb +31 -0
 - data/lib/hunter/version.rb +3 -0
 - metadata +160 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 806b817c321ad7967e4bbd248762f9e5dead3d6a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 572cfd50d60f456a7eff58ff8b91b9c6bbc05c78
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: fe8cf91973baee24ec1b0cc233ba2237824393c386addd927b5042c94e8c3eaaf55a8d0764416f650e83c1ac049316108e09227d397ace6bb854674d9ecb5ec1
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c4ae3099bf9e1917729dbc4b7b81ede8a613bb679746b3f30d7fc172069ffda911be206fbb8d3278a752b6e66a7358289169c8cd70886501c409f8b4b4184deb
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2016 Prospect.io
         
     | 
| 
      
 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.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,108 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Hunter
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            A ruby wrapper around Hunter.io API. Direct access to all the web's email addresses.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 11 
     | 
    
         
            +
            gem 'hunterio'
         
     | 
| 
      
 12 
     | 
    
         
            +
            ```
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                $ gem install hunterio
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 25 
     | 
    
         
            +
            require 'hunterio'
         
     | 
| 
      
 26 
     | 
    
         
            +
            hunter = Hunter.new('Your secret API key')
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            ```
         
     | 
| 
      
 29 
     | 
    
         
            +
            Your secret API key. You can generate it here (https://hunter.io/api_keys)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ## Domain Search API
         
     | 
| 
      
 32 
     | 
    
         
            +
            Returns all the email addresses found using one given domain name, with our sources.
         
     | 
| 
      
 33 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 34 
     | 
    
         
            +
            response = hunter.domain_search('stripe.com')
         
     | 
| 
      
 35 
     | 
    
         
            +
            ```
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            ## Accessing response
         
     | 
| 
      
 38 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 39 
     | 
    
         
            +
            response.status
         
     | 
| 
      
 40 
     | 
    
         
            +
            response.webmail
         
     | 
| 
      
 41 
     | 
    
         
            +
            response.emails
         
     | 
| 
      
 42 
     | 
    
         
            +
            response.pattern
         
     | 
| 
      
 43 
     | 
    
         
            +
            ```
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            ## Email Verifier API
         
     | 
| 
      
 47 
     | 
    
         
            +
            Allows you to verify the deliverability of an email address.
         
     | 
| 
      
 48 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 49 
     | 
    
         
            +
            response = hunter.email_verifier('vincenzo@prospect.io')
         
     | 
| 
      
 50 
     | 
    
         
            +
            ```
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            ## Accessing response
         
     | 
| 
      
 53 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 54 
     | 
    
         
            +
            response.status
         
     | 
| 
      
 55 
     | 
    
         
            +
            response.result
         
     | 
| 
      
 56 
     | 
    
         
            +
            response.score
         
     | 
| 
      
 57 
     | 
    
         
            +
            response.regexp
         
     | 
| 
      
 58 
     | 
    
         
            +
            response.gibberish
         
     | 
| 
      
 59 
     | 
    
         
            +
            response.disposable
         
     | 
| 
      
 60 
     | 
    
         
            +
            response.webmail
         
     | 
| 
      
 61 
     | 
    
         
            +
            response.mx_records
         
     | 
| 
      
 62 
     | 
    
         
            +
            response.smtp_server
         
     | 
| 
      
 63 
     | 
    
         
            +
            response.smtp_check
         
     | 
| 
      
 64 
     | 
    
         
            +
            response.accept_all
         
     | 
| 
      
 65 
     | 
    
         
            +
            response.sources
         
     | 
| 
      
 66 
     | 
    
         
            +
            ```
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            ## Email Finder API
         
     | 
| 
      
 69 
     | 
    
         
            +
            Guesses the most likely email of a person from his first name, his last name and a domain name.
         
     | 
| 
      
 70 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 71 
     | 
    
         
            +
            response = hunter.email_finder('Vincenzo', 'Ruggiero', {domain: 'prospect.io', company: 'Prospect.io'})
         
     | 
| 
      
 72 
     | 
    
         
            +
            ```
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            ## Accessing response
         
     | 
| 
      
 75 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 76 
     | 
    
         
            +
            response.status
         
     | 
| 
      
 77 
     | 
    
         
            +
            response.email
         
     | 
| 
      
 78 
     | 
    
         
            +
            response.score
         
     | 
| 
      
 79 
     | 
    
         
            +
            response.domain
         
     | 
| 
      
 80 
     | 
    
         
            +
            ```
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            ## Email Count API
         
     | 
| 
      
 83 
     | 
    
         
            +
            Returns the number of email addresses found for a domain. This is a FREE API call.
         
     | 
| 
      
 84 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 85 
     | 
    
         
            +
            response = hunter.email_count('prospect.io')
         
     | 
| 
      
 86 
     | 
    
         
            +
            ```
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            ## Accessing count response
         
     | 
| 
      
 89 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 90 
     | 
    
         
            +
            response.status
         
     | 
| 
      
 91 
     | 
    
         
            +
            response.total
         
     | 
| 
      
 92 
     | 
    
         
            +
            response.personal_emails
         
     | 
| 
      
 93 
     | 
    
         
            +
            response.generic_emails
         
     | 
| 
      
 94 
     | 
    
         
            +
            ```
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 97 
     | 
    
         
            +
            The Hunter GEM is released under the MIT License.
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            1. Fork it ( https://github.com/[my-github-username]/hunter/fork )
         
     | 
| 
      
 102 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 103 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 104 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 105 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
            ## Credits
         
     | 
| 
      
 108 
     | 
    
         
            +
            This gem is inspired by the [emailhunter gem](https://github.com/davidesantangelo/emailhunter) made by Davide Santangelo
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "hunter"
         
     | 
| 
      
 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/hunter.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 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/hunter/version', __FILE__)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "hunterio"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = Hunter::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["Vincenzo Ruggiero"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["vincenzo@prospect.io"]
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.homepage      = 'https://github.com/prospectio/hunterio'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              spec.summary       = %q{A Ruby wrapper around Hunter.io API V2}
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.description   = %q{A ruby wrapper around Hunter.io API. Direct access to all the web's email addresses.}
         
     | 
| 
      
 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 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/hunter.rb
    ADDED
    
    
    
        data/lib/hunter/api.rb
    ADDED
    
    | 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            API_URL = 'https://api.hunter.io/v2/'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            require File.expand_path(File.join(File.dirname(__FILE__), 'domain_search'))
         
     | 
| 
      
 6 
     | 
    
         
            +
            require File.expand_path(File.join(File.dirname(__FILE__), 'email_count'))
         
     | 
| 
      
 7 
     | 
    
         
            +
            require File.expand_path(File.join(File.dirname(__FILE__), 'email_finder'))
         
     | 
| 
      
 8 
     | 
    
         
            +
            require File.expand_path(File.join(File.dirname(__FILE__), 'email_verifier'))
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            module Hunter
         
     | 
| 
      
 11 
     | 
    
         
            +
              class Api
         
     | 
| 
      
 12 
     | 
    
         
            +
                attr_reader :key
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              	def initialize(key)
         
     | 
| 
      
 15 
     | 
    
         
            +
              		@key = key
         
     | 
| 
      
 16 
     | 
    
         
            +
              	end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                def domain_search(domain, options = nil)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  Hunter::DomainSearch.new(domain, self.key).perform(options)
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def email_count(domain)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  Hunter::EmailCount.new(domain).perform
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def email_finder(first_name, last_name, options)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  Hunter::EmailFinder.new(first_name, last_name, self.key).perform(options.reject {| key, value | value.nil? })
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                def email_verifier(email)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  Hunter::EmailVerifier.new(email, self.key).perform
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'faraday'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            API_SEARCH_URL = "#{API_URL}domain-search?"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Hunter
         
     | 
| 
      
 7 
     | 
    
         
            +
              class DomainSearch
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(domain, key)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @domain = domain
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @key = key
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def perform(options)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  response = call_api(options)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  Struct.new(*response.keys).new(*response.values)
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                private
         
     | 
| 
      
 20 
     | 
    
         
            +
                def call_api(options)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  url_params = ''
         
     | 
| 
      
 22 
     | 
    
         
            +
                  url_params = options.reject {| key, value | value.nil? }.to_a.map{ |pair| pair.join('=') }.join('&') unless options.nil?
         
     | 
| 
      
 23 
     | 
    
         
            +
                  url =
         
     | 
| 
      
 24 
     | 
    
         
            +
                    URI.parse(URI.encode(
         
     | 
| 
      
 25 
     | 
    
         
            +
                      "#{API_SEARCH_URL}#{url_params}&domain=#{@domain}&api_key=#{@key}")
         
     | 
| 
      
 26 
     | 
    
         
            +
                    )
         
     | 
| 
      
 27 
     | 
    
         
            +
                  response = Faraday.new(url).get
         
     | 
| 
      
 28 
     | 
    
         
            +
                  if response.success?
         
     | 
| 
      
 29 
     | 
    
         
            +
                    JSON.parse(response.body, {symbolize_names: true})[:data].merge!(status: "success")
         
     | 
| 
      
 30 
     | 
    
         
            +
                  else
         
     | 
| 
      
 31 
     | 
    
         
            +
                    {status: 'error'}
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'faraday'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            API_COUNT_URL = "#{API_URL}email-count?"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Hunter
         
     | 
| 
      
 7 
     | 
    
         
            +
              class EmailCount
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(domain)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @domain = domain
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def perform
         
     | 
| 
      
 14 
     | 
    
         
            +
                  response = call_api
         
     | 
| 
      
 15 
     | 
    
         
            +
                  Struct.new(*response.keys).new(*response.values) unless response.empty?
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                private
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def call_api
         
     | 
| 
      
 21 
     | 
    
         
            +
                  url = URI.parse(URI.encode("#{API_COUNT_URL}domain=#{@domain}"))
         
     | 
| 
      
 22 
     | 
    
         
            +
                  response = Faraday.new(url).get
         
     | 
| 
      
 23 
     | 
    
         
            +
                  if response.success?
         
     | 
| 
      
 24 
     | 
    
         
            +
                    JSON.parse(response.body, {symbolize_names: true})[:data].merge!(status: "success")
         
     | 
| 
      
 25 
     | 
    
         
            +
                  else
         
     | 
| 
      
 26 
     | 
    
         
            +
                    {status: 'error'}
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'faraday'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            API_GENERATE_URL = "#{API_URL}email-finder?"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Hunter
         
     | 
| 
      
 7 
     | 
    
         
            +
              class EmailFinder
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(first_name, last_name, key)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @first_name = first_name
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @last_name = last_name
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @key = key
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                def perform(options)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  response = call_api(options)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  Struct.new(*response.keys).new(*response.values) unless response.empty?
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                private
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def call_api(options)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  url_params = options.to_a.map{ |pair| pair.join('=') }.join('&')
         
     | 
| 
      
 24 
     | 
    
         
            +
                  url = URI.parse(URI.encode("#{API_GENERATE_URL}#{url_params}&first_name=#{@first_name}&last_name=#{@last_name}&api_key=#{@key}"))
         
     | 
| 
      
 25 
     | 
    
         
            +
                  response = Faraday.new(url).get
         
     | 
| 
      
 26 
     | 
    
         
            +
                  if response.success?
         
     | 
| 
      
 27 
     | 
    
         
            +
                    JSON.parse(response.body, {symbolize_names: true})[:data].merge!(status: "success")
         
     | 
| 
      
 28 
     | 
    
         
            +
                  else
         
     | 
| 
      
 29 
     | 
    
         
            +
                    {status: 'error'}
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'faraday'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            API_VERIFY_URL = "#{API_URL}email-verifier?"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Hunter
         
     | 
| 
      
 7 
     | 
    
         
            +
              class EmailVerifier
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(email, key)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @email = email
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @key = key
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def perform
         
     | 
| 
      
 15 
     | 
    
         
            +
                  response = call_api
         
     | 
| 
      
 16 
     | 
    
         
            +
                  Struct.new(*response.keys).new(*response.values) unless response.empty?
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                private
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                def call_api
         
     | 
| 
      
 22 
     | 
    
         
            +
                  url = URI.parse(URI.encode("#{API_VERIFY_URL}email=#{@email}&api_key=#{@key}"))
         
     | 
| 
      
 23 
     | 
    
         
            +
                  response = Faraday.new(url).get
         
     | 
| 
      
 24 
     | 
    
         
            +
                  if response.success?
         
     | 
| 
      
 25 
     | 
    
         
            +
                    JSON.parse(response.body, {symbolize_names: true})[:data].merge!(status: "success")
         
     | 
| 
      
 26 
     | 
    
         
            +
                  else
         
     | 
| 
      
 27 
     | 
    
         
            +
                    {status: 'error'}
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,160 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: hunterio
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Vincenzo Ruggiero
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-12-01 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 ruby wrapper around Hunter.io API. Direct access to all the web's email
         
     | 
| 
      
 112 
     | 
    
         
            +
              addresses.
         
     | 
| 
      
 113 
     | 
    
         
            +
            email:
         
     | 
| 
      
 114 
     | 
    
         
            +
            - vincenzo@prospect.io
         
     | 
| 
      
 115 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 116 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 117 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 118 
     | 
    
         
            +
            files:
         
     | 
| 
      
 119 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 120 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 121 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 122 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 123 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 124 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 125 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 126 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 127 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 128 
     | 
    
         
            +
            - hunter.gemspec
         
     | 
| 
      
 129 
     | 
    
         
            +
            - lib/hunter.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - lib/hunter/api.rb
         
     | 
| 
      
 131 
     | 
    
         
            +
            - lib/hunter/domain_search.rb
         
     | 
| 
      
 132 
     | 
    
         
            +
            - lib/hunter/email_count.rb
         
     | 
| 
      
 133 
     | 
    
         
            +
            - lib/hunter/email_finder.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            - lib/hunter/email_verifier.rb
         
     | 
| 
      
 135 
     | 
    
         
            +
            - lib/hunter/version.rb
         
     | 
| 
      
 136 
     | 
    
         
            +
            homepage: https://github.com/prospectio/hunterio
         
     | 
| 
      
 137 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 138 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 139 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 140 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 141 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 142 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 143 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 144 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 145 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 146 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 147 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 148 
     | 
    
         
            +
                  version: 1.9.3
         
     | 
| 
      
 149 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 150 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 151 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 152 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 153 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 154 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 155 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 156 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
      
 157 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 158 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 159 
     | 
    
         
            +
            summary: A Ruby wrapper around Hunter.io API V2
         
     | 
| 
      
 160 
     | 
    
         
            +
            test_files: []
         
     |