Class: SalesforceArSync::SalesforceObjectSyncJob

Inherits:
BaseJob
  • Object
show all
Defined in:
lib/salesforce_ar_sync/jobs/salesforce_object_sync_job.rb

Overview

simple object to be serialized when asynchronously sending data to Salesforce

Instance Method Summary collapse

Instance Method Details

#perform(web_object_name, salesforce_id, attributes) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/salesforce_ar_sync/jobs/salesforce_object_sync_job.rb', line 6

def perform(web_object_name, salesforce_id, attributes)
  web_object = web_object_name.to_s.constantize.find_by_salesforce_id salesforce_id
  # object exists in salesforce if we call its system_mod_stamp
  if web_object&.system_mod_stamp&.present?
    web_object.salesforce_update_object(JSON.parse(attributes))
    web_object.update_attribute(:salesforce_updated_at, web_object.system_mod_stamp)
  end
end