class EmailHunter::Exist

Attributes

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

data() click to toggle source
# File lib/email_hunter/exist.rb, line 21
def data
  @data ||= begin
    response = Faraday.new("#{API_EXIST_URL}email=#{email}&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/exist.rb, line 17
def hunt
  Struct.new(*data.keys).new(*data.values)
end