Class: EmailHunter::Finder
- Inherits:
-
Object
- Object
- EmailHunter::Finder
- Defined in:
- lib/email_hunter/finder.rb
Constant Summary collapse
- API_FINDER_URL =
'https://api.hunter.io/v2/email-finder'
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
- #data ⇒ Object
- #hunt ⇒ Object
-
#initialize(domain, first_name, last_name, key) ⇒ Finder
constructor
A new instance of Finder.
Constructor Details
#initialize(domain, first_name, last_name, key) ⇒ Finder
Returns a new instance of Finder.
12 13 14 15 16 17 |
# File 'lib/email_hunter/finder.rb', line 12 def initialize(domain, first_name, last_name, key) @domain = domain @first_name = first_name @last_name = last_name @key = key end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
10 11 12 |
# File 'lib/email_hunter/finder.rb', line 10 def domain @domain end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
10 11 12 |
# File 'lib/email_hunter/finder.rb', line 10 def email @email end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
10 11 12 |
# File 'lib/email_hunter/finder.rb', line 10 def first_name @first_name end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
10 11 12 |
# File 'lib/email_hunter/finder.rb', line 10 def key @key end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
10 11 12 |
# File 'lib/email_hunter/finder.rb', line 10 def last_name @last_name end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
10 11 12 |
# File 'lib/email_hunter/finder.rb', line 10 def @meta end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
10 11 12 |
# File 'lib/email_hunter/finder.rb', line 10 def score @score end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
10 11 12 |
# File 'lib/email_hunter/finder.rb', line 10 def sources @sources end |
Instance Method Details
#data ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/email_hunter/finder.rb', line 23 def data @data ||= begin response = fetch_finder_data return {} unless response.success? JSON.parse(response.body, symbolize_names: true) end end |
#hunt ⇒ Object
19 20 21 |
# File 'lib/email_hunter/finder.rb', line 19 def hunt Struct.new(*data.keys).new(*data.values) end |