Module: ZohoCrm::Lead

Defined in:
lib/zoho_crm/lead.rb

Class Method Summary collapse

Class Method Details

.create(lead_attributes) ⇒ Object

lead_attributes = {} ZohoCrm::Lead.create(lead_attributes)



20
21
22
23
24
25
26
27
# File 'lib/zoho_crm/lead.rb', line 20

def create(lead_attributes)
  query =
  Hash(
    authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi',
    xmlData: ZohoCrm::ZohoApiUtils.build_attributes('Leads', lead_attributes)
  )
  ZohoCrm::Fetch.post(ZohoCrm::ZohoApiUtils.create_url('Leads', 'insertRecords'), query)
end

.fieldsObject

ZohoCrm::Leads.fields



6
7
8
9
# File 'lib/zoho_crm/lead.rb', line 6

def fields
  query = Hash(authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi')
  ZohoCrm::Fetch.get(ZohoCrm::ZohoApiUtils.create_url('Leads', 'getField'), query)
end

.find(lead_id) ⇒ Object

ZohoCrm::Lead.find(id)



12
13
14
15
16
# File 'lib/zoho_crm/lead.rb', line 12

def find(lead_id)
  raise "Arguments missing: lead_id" if lead_id.nil?
  query = Hash(authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi', id: lead_id)
  ZohoCrm::Fetch.get(ZohoCrm::ZohoApiUtils.create_url('Leads', 'getRecordById'), query)
end

.update(lead_id, lead_attributes) ⇒ Object

ZohoCrm::Lead.update(lead_id, lead_attributes) lead_attributes={}



31
32
33
34
35
36
37
38
39
# File 'lib/zoho_crm/lead.rb', line 31

def update(lead_id, lead_attributes)
  raise "Arguments missing: lead_id" if  lead_id.nil?
  query =
  Hash(
    authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi',
    id: lead_id, xmlData: ZohoCrm::ZohoApiUtils.build_attributes('Leads', lead_attributes)
  )
  ZohoCrm::Fetch.post(ZohoCrm::ZohoApiUtils.create_url('Leads', 'updateRecords'), query)
end