Class: Salesforce::Bulk::Job
- Inherits:
-
Object
- Object
- Salesforce::Bulk::Job
- Includes:
- Blockenspiel::DSL, Attributes
- Defined in:
- lib/salesforce/bulk/job.rb
Instance Attribute Summary collapse
-
#batches ⇒ Object
Returns the value of attribute batches.
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#concurrency_mode ⇒ Object
Returns the value of attribute concurrency_mode.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#id ⇒ Object
Returns the value of attribute id.
-
#number_batches_completed ⇒ Object
Returns the value of attribute number_batches_completed.
-
#number_batches_failed ⇒ Object
Returns the value of attribute number_batches_failed.
-
#number_batches_in_progress ⇒ Object
Returns the value of attribute number_batches_in_progress.
-
#number_batches_total ⇒ Object
Returns the value of attribute number_batches_total.
-
#number_of_batches_queued ⇒ Object
Returns the value of attribute number_of_batches_queued.
-
#number_records_processed ⇒ Object
Returns the value of attribute number_records_processed.
-
#number_retries ⇒ Object
Returns the value of attribute number_retries.
-
#object ⇒ Object
Returns the value of attribute object.
-
#object_type ⇒ Object
Returns the value of attribute object_type.
-
#operation ⇒ Object
Returns the value of attribute operation.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #batch(&block) ⇒ Object
- #completed? ⇒ Boolean
-
#initialize(object_type, operation, columns = :all) ⇒ Job
constructor
A new instance of Job.
- #parallel! ⇒ Object
- #process! ⇒ Object
- #results ⇒ Object
- #serial! ⇒ Object
Methods included from Attributes
Constructor Details
#initialize(object_type, operation, columns = :all) ⇒ Job
Returns a new instance of Job.
18 19 20 21 22 23 24 25 |
# File 'lib/salesforce/bulk/job.rb', line 18 def initialize(object_type, operation, columns = :all) self.object_type = object_type self.object = object_type.table_name self.operation = operation.to_s.downcase self.parallel! self.batches = [] self.columns = columns end |
Instance Attribute Details
#batches ⇒ Object
Returns the value of attribute batches.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def batches @batches end |
#columns ⇒ Object
Returns the value of attribute columns.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def columns @columns end |
#concurrency_mode ⇒ Object
Returns the value of attribute concurrency_mode.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def concurrency_mode @concurrency_mode end |
#content_type ⇒ Object
Returns the value of attribute content_type.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def content_type @content_type end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def id @id end |
#number_batches_completed ⇒ Object
Returns the value of attribute number_batches_completed.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def number_batches_completed @number_batches_completed end |
#number_batches_failed ⇒ Object
Returns the value of attribute number_batches_failed.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def number_batches_failed @number_batches_failed end |
#number_batches_in_progress ⇒ Object
Returns the value of attribute number_batches_in_progress.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def number_batches_in_progress @number_batches_in_progress end |
#number_batches_total ⇒ Object
Returns the value of attribute number_batches_total.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def number_batches_total @number_batches_total end |
#number_of_batches_queued ⇒ Object
Returns the value of attribute number_of_batches_queued.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def number_of_batches_queued @number_of_batches_queued end |
#number_records_processed ⇒ Object
Returns the value of attribute number_records_processed.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def number_records_processed @number_records_processed end |
#number_retries ⇒ Object
Returns the value of attribute number_retries.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def number_retries @number_retries end |
#object ⇒ Object
Returns the value of attribute object.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def object @object end |
#object_type ⇒ Object
Returns the value of attribute object_type.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def object_type @object_type end |
#operation ⇒ Object
Returns the value of attribute operation.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def operation @operation end |
#state ⇒ Object
Returns the value of attribute state.
8 9 10 |
# File 'lib/salesforce/bulk/job.rb', line 8 def state @state end |
Instance Method Details
#batch(&block) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/salesforce/bulk/job.rb', line 35 def batch(&block) Batch.new(self).tap do |batch| Blockenspiel.invoke(block, batch) self.batches << batch end end |
#completed? ⇒ Boolean
48 49 50 51 |
# File 'lib/salesforce/bulk/job.rb', line 48 def completed? self.batches.each(&:update_status) self.batches.all? { |batch| batch.completed? || batch.failed? } end |
#parallel! ⇒ Object
27 28 29 |
# File 'lib/salesforce/bulk/job.rb', line 27 def parallel! self.concurrency_mode = "Parallel" end |
#process! ⇒ Object
42 43 44 45 46 |
# File 'lib/salesforce/bulk/job.rb', line 42 def process! create_job! create_batches! close_job! end |
#results ⇒ Object
53 54 55 |
# File 'lib/salesforce/bulk/job.rb', line 53 def results self.batches.map(&:results).flatten end |
#serial! ⇒ Object
31 32 33 |
# File 'lib/salesforce/bulk/job.rb', line 31 def serial! self.concurrency_mode = "Serial" end |