class EmailHunter::Finder

Attributes

domain[R]
email[R]
first_name[R]
key[R]
last_name[R]
meta[R]
score[R]
sources[R]

Public Class Methods

new(domain, first_name, last_name, key) click to toggle source
# File lib/email_hunter/finder.rb, line 12
def initialize(domain, first_name, last_name, key)
  @domain = domain
  @first_name = first_name
  @last_name = last_name
  @key = key
end

Public Instance Methods

data() click to toggle source
# File lib/email_hunter/finder.rb, line 23
def data
  @data ||= begin
    response = Faraday.new("#{API_FINDER_URL}domain=#{domain}&first_name=#{first_name}&last_name=#{last_name}&api_key=#{key}").get

    return [] unless response.success?

    JSON.parse(response.body, { symbolize_names: true })
  end
end
hunt() click to toggle source
# File lib/email_hunter/finder.rb, line 19
def hunt
  Struct.new(*data.keys).new(*data.values)
end