class EmailHunter::Finder
Constants
- API_FINDER_URL
Attributes
Public Class Methods
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
Source
# File lib/email_hunter/finder.rb, line 23 def data @data ||= begin response = fetch_finder_data return {} unless response.success? JSON.parse(response.body, symbolize_names: true) end end
Source
# File lib/email_hunter/finder.rb, line 19 def hunt Struct.new(*data.keys).new(*data.values) end
Private Instance Methods
Source
# File lib/email_hunter/finder.rb, line 35 def fetch_finder_data connection = Faraday.new params = { domain: domain, first_name: first_name, last_name: last_name, api_key: key } connection.get(API_FINDER_URL, params) end