Class: EmailHunter::Verify

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

Constant Summary collapse

API_URL =
'https://api.hunter.io/v2/email-verifier'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email, key) ⇒ Verify

Returns a new instance of Verify.



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

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

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#keyObject (readonly)

Returns the value of attribute key.



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

def key
  @key
end

Instance Method Details

#huntObject



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

def hunt
  response_data = fetch_verify_data
  return nil if response_data.empty?

  Struct.new(*response_data.keys).new(*response_data.values)
end