Class: SalesforceArSync::SalesforceObjectSync

Inherits:
Struct
  • Object
show all
Defined in:
lib/salesforce_ar_sync/salesforce_object_sync.rb

Overview

simple object to be serialized when asynchronously sending data to Salesforce

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



3
4
5
# File 'lib/salesforce_ar_sync/salesforce_object_sync.rb', line 3

def attributes
  @attributes
end

#salesforce_idObject

Returns the value of attribute salesforce_id

Returns:

  • (Object)

    the current value of salesforce_id



3
4
5
# File 'lib/salesforce_ar_sync/salesforce_object_sync.rb', line 3

def salesforce_id
  @salesforce_id
end

#web_object_nameObject

Returns the value of attribute web_object_name

Returns:

  • (Object)

    the current value of web_object_name



3
4
5
# File 'lib/salesforce_ar_sync/salesforce_object_sync.rb', line 3

def web_object_name
  @web_object_name
end

Instance Method Details

#performObject



4
5
6
7
8
9
10
11
# File 'lib/salesforce_ar_sync/salesforce_object_sync.rb', line 4

def perform        
  web_object = "#{web_object_name}".constantize.find_by_salesforce_id salesforce_id
  #object exists in salesforce if we call its system_mod_stamp
  if (system_mod_stamp = web_object.system_mod_stamp)
    web_object.salesforce_update_object(web_object.salesforce_attributes_to_update(true))
    web_object.update_attribute(:salesforce_updated_at, system_mod_stamp)
  end
end