Class: EmailHunter::Leads
- Inherits:
-
Object
- Object
- EmailHunter::Leads
- Defined in:
- lib/email_hunter/leads.rb
Constant Summary collapse
- API_URL =
'https://api.hunter.io/v2/leads'
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#lead_id ⇒ Object
readonly
Returns the value of attribute lead_id.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #hunt ⇒ Object
-
#initialize(key, action: :list, lead_id: nil, data: nil, params: {}) ⇒ Leads
constructor
A new instance of Leads.
Constructor Details
#initialize(key, action: :list, lead_id: nil, data: nil, params: {}) ⇒ Leads
Returns a new instance of Leads.
13 14 15 16 17 18 19 |
# File 'lib/email_hunter/leads.rb', line 13 def initialize(key, action: :list, lead_id: nil, data: nil, params: {}) @key = key @action = action @lead_id = lead_id @data = data @params = params end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
11 12 13 |
# File 'lib/email_hunter/leads.rb', line 11 def action @action end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/email_hunter/leads.rb', line 11 def data @data end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
11 12 13 |
# File 'lib/email_hunter/leads.rb', line 11 def key @key end |
#lead_id ⇒ Object (readonly)
Returns the value of attribute lead_id.
11 12 13 |
# File 'lib/email_hunter/leads.rb', line 11 def lead_id @lead_id end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
11 12 13 |
# File 'lib/email_hunter/leads.rb', line 11 def params @params end |
Instance Method Details
#hunt ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/email_hunter/leads.rb', line 21 def hunt case action when :list list_leads when :create create_lead when :update update_lead when :delete delete_lead else raise ArgumentError, "Unknown action: #{action}" end end |