Class: EmailHunter::Count

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain) ⇒ Count

Returns a new instance of Count.



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

def initialize(domain)
  @domain = domain
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



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

def domain
  @domain
end

Instance Method Details

#huntObject



16
17
18
19
20
21
# File 'lib/email_hunter/count.rb', line 16

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

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