Class: Remi::Loader::SalesforceSoap
- Inherits:
-
Remi::Loader
- Object
- Remi::Loader
- Remi::Loader::SalesforceSoap
- Includes:
- DataSubject::SalesforceSoap
- Defined in:
- lib/remi/data_subjects/salesforce_soap.rb
Overview
Salesforce SOAP loader
The Salesforce SOAP loader can be used to merge salesforce objects (for those
objects that support the merge operation). To do so, each row of the dataframe must
contain a field called :Id
that references the master record that survives the
merge operation. It must also contain a :Merge_Id
field that specifies the
salesforce Id of the record that is to be merged into the master. Other fields
may also be specified that will be used to update the master record.
Instance Attribute Summary
Attributes inherited from Remi::Loader
Instance Method Summary collapse
-
#initialize(*args, **kargs, &block) ⇒ SalesforceSoap
constructor
A new instance of SalesforceSoap.
-
#load(data) ⇒ true
On success.
Methods included from DataSubject::SalesforceSoap
Methods inherited from Remi::Loader
Constructor Details
#initialize(*args, **kargs, &block) ⇒ SalesforceSoap
Returns a new instance of SalesforceSoap.
65 66 67 68 |
# File 'lib/remi/data_subjects/salesforce_soap.rb', line 65 def initialize(*args, **kargs, &block) super init_salesforce_loader(*args, **kargs, &block) end |
Instance Method Details
#load(data) ⇒ true
Returns On success.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/remi/data_subjects/salesforce_soap.rb', line 72 def load(data) logger.info "Performing Salesforce Soap #{@operation} on object #{@sfo}" if @operation == :merge # The Soapforce gem only supports one slow-ass merge at a time :( data.each do |row| unless row.include?(@merge_id_field) raise KeyError, "Merge id field not found: #{@merge_id_field}" end merge_id = Array(row.delete(@merge_id_field)) soapforce_client.merge(@sfo, row, merge_id) end else raise ArgumentError, "Unknown soap operation: #{@operation}" end end |