Class: Remi::DataTarget::Salesforce
- Inherits:
-
Remi::DataSubject
- Object
- Remi::DataSubject
- Remi::DataTarget::Salesforce
- Defined in:
- lib/remi/data_subject/salesforce.rb
Instance Attribute Summary
Attributes inherited from Remi::DataSubject
Instance Method Summary collapse
-
#initialize(*args, **kargs, &block) ⇒ Salesforce
constructor
A new instance of Salesforce.
-
#load! ⇒ Object
Public: Performs the load operation, regardless of whether it has already executed.
Methods included from Remi::DataSubject::Salesforce
#field_symbolizer, #restforce_client
Methods included from Remi::DataSubject::DataTarget
Methods inherited from Remi::DataSubject
Constructor Details
#initialize(*args, **kargs, &block) ⇒ Salesforce
Returns a new instance of Salesforce.
99 100 101 102 |
# File 'lib/remi/data_subject/salesforce.rb', line 99 def initialize(*args, **kargs, &block) super init_salesforce(*args, **kargs, &block) end |
Instance Method Details
#load! ⇒ Object
Public: Performs the load operation, regardless of whether it has already executed.
Returns true if the load operation was successful
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/remi/data_subject/salesforce.rb', line 108 def load! @logger.info "Performing Salesforce #{@operation} on object #{@sfo}" df_as_array_of_hashes = df.to_a[0] # This probably wouldn't work with a non-Daru df if @operation == :update Remi::SfBulkHelper::SfBulkUpdate.update(restforce_client, @sfo, df_as_array_of_hashes, batch_size: @batch_size, logger: @logger) elsif @operation == :create Remi::SfBulkHelper::SfBulkCreate.create(restforce_client, @sfo, df_as_array_of_hashes, batch_size: @batch_size, logger: @logger) elsif @operation == :upsert Remi::SfBulkHelper::SfBulkUpsert.upsert(restforce_client, @sfo, df_as_array_of_hashes, batch_size: @batch_size, external_id: @external_id, logger: @logger) else raise ArgumentError, "Unknown operation: #{@operation}" end true end |