Module: ZohoWrapper::ActiveRecord
- Defined in:
- lib/zoho_wrapper/lead.rb
Instance Method Summary collapse
Instance Method Details
#zoho_remove ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zoho_wrapper/lead.rb', line 21 def zoho_remove logger.info 'Removing #{fullname} from zoho' begin setup_zoho leads = RubyZoho::Crm::Lead.find_by_email(self.email) for lead in leads RubyZoho::Crm::Lead.delete(lead.id) end self.on_zoho = false self.save! rescue Exception => exception logger.error( "<Error while trying to REMOVE lead at zoho> \n" + "#{exception.class} (#{exception.message})") return false end end |
#zoho_save ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/zoho_wrapper/lead.rb', line 4 def zoho_save logger.info 'Saving #{fullname} to zoho' begin setup_zoho lead = RubyZoho::Crm::Lead.new(self.zoho_lead.dup) lead.save self.on_zoho = true self.save! rescue Exception => exception logger.error( "<Error while trying to SAVE new lead at zoho> \n" + "#{exception.class} (#{exception.message})") return false end end |