Class: EmailHunter::Verify

Inherits:
Object
  • Object
show all
Defined in:
lib/email_hunter/verify.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email, key) ⇒ Verify

Returns a new instance of Verify.



13
14
15
16
# File 'lib/email_hunter/verify.rb', line 13

def initialize(email, key)
  @email = email
  @key = key
end

Instance Attribute Details

#accept_allObject (readonly)

Returns the value of attribute accept_all.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def accept_all
  @accept_all
end

#disposableObject (readonly)

Returns the value of attribute disposable.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def disposable
  @disposable
end

#emailObject (readonly)

Returns the value of attribute email.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def email
  @email
end

#gibberishObject (readonly)

Returns the value of attribute gibberish.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def gibberish
  @gibberish
end

#keyObject (readonly)

Returns the value of attribute key.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def key
  @key
end

#metaObject (readonly)

Returns the value of attribute meta.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def meta
  @meta
end

#mx_recordsObject (readonly)

Returns the value of attribute mx_records.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def mx_records
  @mx_records
end

#regexpObject (readonly)

Returns the value of attribute regexp.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def regexp
  @regexp
end

#resultObject (readonly)

Returns the value of attribute result.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def result
  @result
end

#scoreObject (readonly)

Returns the value of attribute score.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def score
  @score
end

#smtp_checkObject (readonly)

Returns the value of attribute smtp_check.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def smtp_check
  @smtp_check
end

#smtp_serverObject (readonly)

Returns the value of attribute smtp_server.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def smtp_server
  @smtp_server
end

#sourcesObject (readonly)

Returns the value of attribute sources.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def sources
  @sources
end

#webmailObject (readonly)

Returns the value of attribute webmail.



10
11
12
# File 'lib/email_hunter/verify.rb', line 10

def webmail
  @webmail
end

Instance Method Details

#dataObject



22
23
24
25
26
27
28
29
30
# File 'lib/email_hunter/verify.rb', line 22

def data
  @data ||= begin
    response = Faraday.new("#{API_VERIFY_URL}email=#{email}&api_key=#{key}").get

    return [] unless response.success?

    JSON.parse(response.body, { symbolize_names: true })
  end
end

#huntObject



18
19
20
# File 'lib/email_hunter/verify.rb', line 18

def hunt
  Struct.new(*data.keys).new(*data.values)
end