Module: SfCli::Sf::Data::Resume

Defined in:
lib/sf_cli/sf/data/resume.rb

Defined Under Namespace

Classes: JobInfo

Instance Method Summary collapse

Instance Method Details

#resume(job_id:, target_org: nil, api_version: nil) ⇒ JobInfo

View the status of a bulk job. The job info object has methods to check the job status:

  • opened?

  • upload_completed?

  • in_progress?

  • completed?

To know job status more, take a look at the bulk API developer guide

Examples:

# start a delete job
jobinfo = sf.data.delete_bulk sobject: :TestCustomObject__c, file: 'delete.csv' # this returns immediately
jobinfo.id  # => "750J4000003g1OaIAI" it's job ID

jobinfo2 = sf.data.resume job_id: jobinfo.id

puts 'yey!' if job_info2.completed? # the job has completed

Parameters:

  • job_id (String)

    job ID you want to resume

  • target_org (Symbol, String) (defaults to: nil)

    an alias of paticular org, or username can be used

  • api_version (Numeric) (defaults to: nil)

    override the api version used for api requests made by this command

Returns:

See Also:



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/sf_cli/sf/data/resume.rb', line 77

def resume(job_id:, target_org: nil, api_version: nil)
  flags = {
    :"job-id"     => job_id,
    :"target-org" => target_org,
    :"api-version" => api_version,
  }
  json = exec(__method__, flags: flags, redirection: :null_stderr)

  json['result'].delete '$'
  JobInfo.new(**json['result'])
end