Module: SfCli::Sf::Data::UpsertBulk
- Defined in:
- lib/sf_cli/sf/data/upsert_bulk.rb
Instance Method Summary collapse
-
#upsert_bulk(file:, sobject:, external_id:, wait: nil, target_org: nil, api_version: nil) ⇒ JobInfo, BulkResultV2
Update records using Bulk API 2.0.
Instance Method Details
#upsert_bulk(file:, sobject:, external_id:, wait: nil, target_org: nil, api_version: nil) ⇒ JobInfo, BulkResultV2
Update records using Bulk API 2.0
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/sf_cli/sf/data/upsert_bulk.rb', line 39 def upsert_bulk(file:, sobject:, external_id:, wait: nil, target_org: nil, api_version: nil) _file = create_tmpfile_by_io(file) path = _file&.path || file flags = { :"file" => path, :"sobject" => sobject, :"external-id" => external_id, :"wait" => wait, :"target-org" => target_org, :"api-version" => api_version, } action = __method__.to_s.tr('_', ' ') json = exec(action, flags: flags, redirection: :null_stderr) job_info = ::SfCli::Sf::Data::JobInfo.new(**json['result']['jobInfo']) return job_info unless json['result']['records'] ::SfCli::Sf::Data::BulkResultV2.new( job_info: job_info, records: ::SfCli::Sf::Data::BulkRecordsV2.new(**json['result']['records']) ) ensure _file&.close! end |