class CrmLeadRepository

Public Class Methods

delete(rd_lead) click to toggle source
# File lib/crm_integration/crm_lead_repository.rb, line 14
def self.delete(rd_lead)
  crm_lead = load_crm_lead_by_email(rd_lead.email_was)
  RubyZoho::Crm::Lead.delete(crm_lead.leadid)
end
load_crm_lead_by_email(email) click to toggle source
# File lib/crm_integration/crm_lead_repository.rb, line 19
def self.load_crm_lead_by_email(email)
  leads = RubyZoho::Crm::Lead.find_by_email(email)
  leads && !leads.empty? ? leads.first : nil
end
post(rd_lead) click to toggle source
# File lib/crm_integration/crm_lead_repository.rb, line 4
def self.post(rd_lead)
  crm_lead = RubyZoho::Crm::Lead.new(map_from(rd_lead))
  crm_lead.save
end
put(rd_lead) click to toggle source
# File lib/crm_integration/crm_lead_repository.rb, line 9
def self.put(rd_lead)
  crm_lead = load_crm_lead_by_email(rd_lead.email_was)
  RubyZoho::Crm::Lead.update(map_from(rd_lead).merge(:id => crm_lead.leadid))
end