class EmailHunter::Finder

Attributes

domain[R]
email[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

hunt() click to toggle source
# File lib/email_hunter/finder.rb, line 19
def hunt
  response = apiresponse
  Struct.new(*response.keys).new(*response.values) unless response.empty?
end

Private Instance Methods

apiresponse() click to toggle source
# File lib/email_hunter/finder.rb, line 26
def apiresponse
  response = Faraday.new("#{API_FINDER_URL}domain=#{@domain}&first_name=#{@first_name}&last_name=#{@last_name}&api_key=#{@key}").get
  response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
end