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