class EmailHunter::Count

Attributes

data[R]
meta[R]

Public Class Methods

new(domain) click to toggle source
# File lib/email_hunter/count.rb, line 10
def initialize(domain)
  @domain = domain
end

Public Instance Methods

hunt() click to toggle source
# File lib/email_hunter/count.rb, line 14
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/count.rb, line 21
def apiresponse
  response = Faraday.new("#{API_COUNT_URL}domain=#{@domain}").get
  response.success? ? JSON.parse(response.body, { symbolize_names: true }) : []
end