class SalesforceAdapter::Operations::Update
Public Class Methods
new(rforce_binding, table_name, attributes)
click to toggle source
Calls superclass method
SalesforceAdapter::Operations::Base::new
# File lib/salesforce_adapter/operations/update.rb, line 19 def initialize(rforce_binding, table_name, attributes) @table_name = table_name @attributes = attributes super(rforce_binding) end
Private Instance Methods
context()
click to toggle source
# File lib/salesforce_adapter/operations/update.rb, line 29 def context "updating salesforce #{@table_name} with attributes #{Helpers.hash_to_s(@attributes)}" end
format_response()
click to toggle source
# File lib/salesforce_adapter/operations/update.rb, line 53 def format_response # Return the id @response[:updateResponse][:result][:id] end
perform()
click to toggle source
# File lib/salesforce_adapter/operations/update.rb, line 38 def perform rforce_binding.update( @table_name => Helpers.format_fields_for_create_or_update(@attributes) ) end
validate_request!()
click to toggle source
# File lib/salesforce_adapter/operations/update.rb, line 33 def validate_request! raise ArgumentError.new("Id must be specified for a Salesforce Update") unless @attributes[:Id] raise ArgumentError.new("type must be specified for a Salesforce Update") unless @attributes[:type] end
validate_response!()
click to toggle source
Calls superclass method
SalesforceAdapter::Operations::Base#validate_response!
# File lib/salesforce_adapter/operations/update.rb, line 42 def validate_response! super # Raise exception on update failure if !@response[:updateResponse][:result][:success] sf_error_code = @response[:updateResponse][:result][:errors][:statusCode] sf_error_message = @response[:updateResponse][:result][:errors][:message] raise SalesforceFailedUpdate.new(sf_error_code), "#{sf_error_message}\nContext : #{context}" end end