Class: EmailHunter::Api

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

Overview

Main API client for EmailHunter services

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ Api

Returns a new instance of Api.



15
16
17
# File 'lib/email_hunter/api.rb', line 15

def initialize(key)
  @key = key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



13
14
15
# File 'lib/email_hunter/api.rb', line 13

def key
  @key
end

Instance Method Details

#accountObject

Account Information API



45
46
47
# File 'lib/email_hunter/api.rb', line 45

def 
  execute_hunt(Account)
end

#campaign_add_recipient(campaign_id, data) ⇒ Object

Campaigns API - Add recipient to campaign



95
96
97
# File 'lib/email_hunter/api.rb', line 95

def campaign_add_recipient(campaign_id, data)
  Campaigns.new(key, action: :add_recipient, campaign_id: campaign_id, data: data).hunt
end

#campaign_delete_recipient(campaign_id, email) ⇒ Object

Campaigns API - Delete recipient from campaign



100
101
102
# File 'lib/email_hunter/api.rb', line 100

def campaign_delete_recipient(campaign_id, email)
  Campaigns.new(key, action: :delete_recipient, campaign_id: campaign_id, data: { email: email }).hunt
end

#campaign_recipients(campaign_id, params = {}) ⇒ Object

Campaigns API - Get campaign recipients



90
91
92
# File 'lib/email_hunter/api.rb', line 90

def campaign_recipients(campaign_id, params = {})
  Campaigns.new(key, action: :recipients, campaign_id: campaign_id, params: params).hunt
end

#campaigns(params = {}) ⇒ Object

Campaigns API - List campaigns



85
86
87
# File 'lib/email_hunter/api.rb', line 85

def campaigns(params = {})
  Campaigns.new(key, action: :list, params: params).hunt
end

#combined_enrichment(email: nil, linkedin: nil) ⇒ Object

Combined Enrichment API - Enrich both lead and company data



115
116
117
# File 'lib/email_hunter/api.rb', line 115

def combined_enrichment(email: nil, linkedin: nil)
  CombinedEnrichment.new(key, email: email, linkedin: linkedin).hunt
end

#company(domain) ⇒ Object

Company Information API



50
51
52
# File 'lib/email_hunter/api.rb', line 50

def company(domain)
  execute_hunt(Company, domain)
end

#company_enrichment(domain) ⇒ Object

Company Enrichment API - Enrich company data



110
111
112
# File 'lib/email_hunter/api.rb', line 110

def company_enrichment(domain)
  CompanyEnrichment.new(domain, key).hunt
end

#count(domain) ⇒ Object

Email Count API



40
41
42
# File 'lib/email_hunter/api.rb', line 40

def count(domain)
  execute_hunt(Count, domain)
end

#discover(query, params = {}) ⇒ Object

Discover API - Search companies using natural language



60
61
62
# File 'lib/email_hunter/api.rb', line 60

def discover(query, params = {})
  execute_hunt(Discover, query, params)
end

#exist(email) ⇒ Object

Email exist API



25
26
27
# File 'lib/email_hunter/api.rb', line 25

def exist(email)
  execute_hunt(Exist, email)
end

#finder(domain, first_name, last_name) ⇒ Object

Email Finder API



35
36
37
# File 'lib/email_hunter/api.rb', line 35

def finder(domain, first_name, last_name)
  EmailHunter::Finder.new(domain, first_name, last_name, key).hunt
end

#lead_create(data) ⇒ Object

Leads API - Create lead



70
71
72
# File 'lib/email_hunter/api.rb', line 70

def lead_create(data)
  Leads.new(key, action: :create, data: data).hunt
end

#lead_delete(id) ⇒ Object

Leads API - Delete lead



80
81
82
# File 'lib/email_hunter/api.rb', line 80

def lead_delete(id)
  Leads.new(key, action: :delete, lead_id: id).hunt
end

#lead_enrichment(email: nil, linkedin: nil) ⇒ Object

Lead Enrichment API - Enrich person data



105
106
107
# File 'lib/email_hunter/api.rb', line 105

def lead_enrichment(email: nil, linkedin: nil)
  LeadEnrichment.new(key, email: email, linkedin: linkedin).hunt
end

#lead_update(id, data) ⇒ Object

Leads API - Update lead



75
76
77
# File 'lib/email_hunter/api.rb', line 75

def lead_update(id, data)
  Leads.new(key, action: :update, lead_id: id, data: data).hunt
end

#leads(params = {}) ⇒ Object

Leads API - List leads



65
66
67
# File 'lib/email_hunter/api.rb', line 65

def leads(params = {})
  Leads.new(key, action: :list, params: params).hunt
end

#people(domain) ⇒ Object

People Information API



55
56
57
# File 'lib/email_hunter/api.rb', line 55

def people(domain)
  execute_hunt(People, domain)
end

#search(domain, params = {}) ⇒ Object

Domain search API



20
21
22
# File 'lib/email_hunter/api.rb', line 20

def search(domain, params = {})
  execute_hunt(Search, domain, params)
end

#verify(email) ⇒ Object

Email verify API



30
31
32
# File 'lib/email_hunter/api.rb', line 30

def verify(email)
  execute_hunt(Verify, email)
end