class EmailHunter::Count
Constants
- API_URL
Attributes
Public Class Methods
Source
# File lib/email_hunter/count.rb, line 12 def initialize(domain) @domain = domain end
Public Instance Methods
Source
# 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
Private Instance Methods
Source
# File lib/email_hunter/count.rb, line 25 def fetch_count_data @fetch_count_data ||= begin connection = Faraday.new response = connection.get(API_URL, domain: domain) return {} unless response.success? JSON.parse(response.body, symbolize_names: true) end end