class EmailHunter::Search
Attributes
domain[R]
emails[R]
meta[R]
pattern[R]
webmail[R]
Public Class Methods
new(domain, key, params = {})
click to toggle source
# File lib/email_hunter/search.rb, line 12 def initialize(domain, key, params = {}) @domain = domain @key = key @params = params end
Public Instance Methods
hunt()
click to toggle source
# File lib/email_hunter/search.rb, line 18 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/search.rb, line 25 def apiresponse response = Faraday.new("#{API_SEARCH_URL}domain=#{@domain}&api_key=#{@key}&type=#{@params[:type]}&offset=#{@params[:offset]}&limit=#{@params[:limit]}").get response.success? ? JSON.parse(response.body, { symbolize_names: true }) : [] end