class Restforce::DB::Instances::Salesforce

Restforce::DB::Instances::Salesforce serves as a wrapper for Salesforce objects, exposing a common API to reconcile record attributes with ActiveRecord instances.

Constants

INTERNAL_ATTRIBUTES

Public Instance Methods

id() click to toggle source

Public: Get a common identifier for this record.

Returns a String.

# File lib/restforce/db/instances/salesforce.rb, line 22
def id
  @record.Id
end
last_update() click to toggle source

Public: Get the time of the last update to this record.

Returns a Time-compatible object.

# File lib/restforce/db/instances/salesforce.rb, line 39
def last_update
  Time.parse(@record.SystemModstamp)
end
synced?() click to toggle source

Public: Has this record been synced with Salesforce?

Returns a Boolean.

# File lib/restforce/db/instances/salesforce.rb, line 46
def synced?
  @mapping.database_model.exists?(@mapping.lookup_column => id)
end
update!(attributes) click to toggle source

Public: Update the instance with the passed attributes.

attributes - A Hash mapping attribute names to values.

Returns self. Raises if the update fails for any reason.

Calls superclass method Restforce::DB::Instances::Base#update!
# File lib/restforce/db/instances/salesforce.rb, line 32
def update!(attributes)
  super FieldProcessor.new.process(@record_type, attributes, :update)
end
updated_internally?() click to toggle source

Public: Was this record most recently updated by Restforce::DB's workflow?

Returns a Boolean.

# File lib/restforce/db/instances/salesforce.rb, line 54
def updated_internally?
  @record.LastModifiedById == DB.user_id
end