Class: Tomba::Leads
Overview
Leads service for managing individual leads.
Provides methods to list, get, create, update, and delete leads.
Instance Method Summary collapse
-
#create_lead(**data) ⇒ Hash
Create Lead.
-
#delete_lead(id) ⇒ Hash
Delete Lead.
-
#get_lead(id) ⇒ Hash
Get Lead.
-
#list_leads(page: nil, limit: nil, domain: nil) ⇒ Hash
List Leads.
-
#update_lead(id, **data) ⇒ Hash
Update Lead.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Tomba::Service
Instance Method Details
#create_lead(**data) ⇒ Hash
Create Lead
Creates a new lead with the provided data.
61 62 63 64 65 66 67 |
# File 'lib/tomba/services/leads.rb', line 61 def create_lead(**data) path = '/leads' @client.call('post', path, { 'content-type' => 'application/json' }, data) end |
#delete_lead(id) ⇒ Hash
Delete Lead
Deletes a specific lead by its ID.
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/tomba/services/leads.rb', line 96 def delete_lead(id) raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil? path = "/leads/#{id}" params = {} @client.call('delete', path, { 'content-type' => 'application/json' }, params) end |
#get_lead(id) ⇒ Hash
Get Lead
Returns a specific lead by its ID.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/tomba/services/leads.rb', line 41 def get_lead(id) raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil? path = "/leads/#{id}" params = {} @client.call('get', path, { 'content-type' => 'application/json' }, params) end |
#list_leads(page: nil, limit: nil, domain: nil) ⇒ Hash
List Leads
Returns a paginated list of leads.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/tomba/services/leads.rb', line 20 def list_leads(page: nil, limit: nil, domain: nil) path = '/leads' params = {} params[:page] = page unless page.nil? params[:limit] = limit unless limit.nil? params[:domain] = domain unless domain.nil? @client.call('get', path, { 'content-type' => 'application/json' }, params) end |
#update_lead(id, **data) ⇒ Hash
Update Lead
Updates an existing lead by its ID.
78 79 80 81 82 83 84 85 86 |
# File 'lib/tomba/services/leads.rb', line 78 def update_lead(id, **data) raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil? path = "/leads/#{id}" @client.call('put', path, { 'content-type' => 'application/json' }, data) end |