Class: SalesforceBulkClient::Client
- Inherits:
-
Object
- Object
- SalesforceBulkClient::Client
- Defined in:
- lib/salesforce_bulk_client/client.rb
Constant Summary collapse
- DEFAULT_CLIENT_OPTIONS =
{ salesforce_api_version: '49.0' }
Instance Method Summary collapse
- #delete(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
-
#initialize(restforce_client, options = {}) ⇒ Client
constructor
A new instance of Client.
- #insert(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
- #job_from_id(job_id) ⇒ Object
- #query(sobject, query, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
- #update(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
- #upsert(sobject, records, external_field, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
Constructor Details
#initialize(restforce_client, options = {}) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/salesforce_bulk_client/client.rb', line 9 def initialize(restforce_client, = {}) = {}.merge(DEFAULT_CLIENT_OPTIONS).merge() @connection = SalesforceBulkClient::Connection.new([:salesforce_api_version], restforce_client) end |
Instance Method Details
#delete(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
14 15 16 |
# File 'lib/salesforce_bulk_client/client.rb', line 14 def delete(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) do_operation('delete', sobject, records, nil, get_response, timeout, batch_size, poll_delay) end |
#insert(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
18 19 20 |
# File 'lib/salesforce_bulk_client/client.rb', line 18 def insert(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) do_operation('insert', sobject, records, nil, get_response, timeout, batch_size, poll_delay) end |
#job_from_id(job_id) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/salesforce_bulk_client/client.rb', line 34 def job_from_id(job_id) job = SalesforceBulkClient::Job.new(job_id: job_id, connection: @connection) job_status = job.check_job_status batches = job.list_batches job.instance_variable_set(:@operation, job_status.operation) job.instance_variable_set(:@sobject, job_status.object) job.instance_variable_set(:@batch_ids, batches.map { |batch_info| batch_info.id }) job end |
#query(sobject, query, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
22 23 24 |
# File 'lib/salesforce_bulk_client/client.rb', line 22 def query(sobject, query, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) do_operation('query', sobject, query,nil, get_response, timeout, batch_size, poll_delay) end |
#update(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
26 27 28 |
# File 'lib/salesforce_bulk_client/client.rb', line 26 def update(sobject, records, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) do_operation('update', sobject, records, nil, get_response, timeout, batch_size, poll_delay) end |
#upsert(sobject, records, external_field, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) ⇒ Object
30 31 32 |
# File 'lib/salesforce_bulk_client/client.rb', line 30 def upsert(sobject, records, external_field, get_response = false, batch_size = 10000, timeout = 3600, poll_delay = 5) do_operation('upsert', sobject, records, external_field, get_response, timeout, batch_size, poll_delay) end |