class Executrix::Batch
Attributes
job_id[R]
Public Class Methods
new(connection, job_id, batch_id)
click to toggle source
# File lib/executrix/batch.rb, line 5 def initialize connection, job_id, batch_id @connection = connection @job_id = job_id @batch_id = batch_id if @batch_id == -1 @final_status = { state: 'Completed', state_message: 'Empty Request' } end end
Public Instance Methods
final_status(poll_interval=2) { |final_status| ... }
click to toggle source
# File lib/executrix/batch.rb, line 18 def final_status poll_interval=2 return @final_status if @final_status @final_status = self.status while ['Queued', 'InProgress'].include?(@final_status[:state]) sleep poll_interval @final_status = self.status yield @final_status if block_given? end raise @final_status[:state_message] if @final_status[:state] == 'Failed' @final_status.merge({ results: results }) end
raw_request()
click to toggle source
# File lib/executrix/batch.rb, line 47 def raw_request @connection.raw_request end
raw_result()
click to toggle source
# File lib/executrix/batch.rb, line 51 def raw_result @connection.raw_result end
results()
click to toggle source
results returned from Salesforce can be a single page id, or an array of ids. if it’s an array of ids, we will fetch the results from each, and concatenate them.
# File lib/executrix/batch.rb, line 41 def results Array(query_result_id).map do |result_id| @connection.query_batch_result_data(@job_id, @batch_id, result_id) end.flatten end
status()
click to toggle source
# File lib/executrix/batch.rb, line 35 def status @connection.query_batch @job_id, @batch_id end
Private Instance Methods
query_result_id()
click to toggle source
# File lib/executrix/batch.rb, line 56 def query_result_id result_raw = @connection.query_batch_result_id(@job_id, @batch_id) result_raw[:result] if result_raw end