class EmailHunter::Exist

Attributes

email[R]
exist[R]
sources[R]
status[R]

Public Class Methods

new(email, key) click to toggle source
# File lib/email_hunter/exist.rb, line 12
def initialize(email, key)
  @email = email
  @key = key
end

Public Instance Methods

hunt() click to toggle source
# File lib/email_hunter/exist.rb, line 17
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/exist.rb, line 24
def apiresponse
  response = Faraday.new("#{API_EXIST_URL}email=#{@email}&api_key=#{@key}").get
  response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
end