I have a multi-tenant application, and need to create Batch Jobs for many different Salesforce organizations, which means many different Restforce clients. It would be great if the Job creation API supported that, as it's effectively hard-coded to Restforce::Bulk.client as far as I can tell.
From what I can tell, I can do it by basically re-implementing Restforce::Bulk::Job::create, but that isn't very clean:
# My own application code, used to get Restforce::Data::Client instance for a User.
restforce_client = User.first.get_restforce_client
bulk_client = Restforce::Bulk::Client.new(restforce_client)
job_builder = Restforce::Bulk::Builder::Xml.new(:query)
job_data = job_builder.job('Contact', 'CSV')
job_create_response = bulk_client.perform_request(:post, 'job', job_data)
job = Restforce::Bulk::Job.new(job_create_response.body.jobInfo)
Almost seems like that should be:
bulk_client = Restforce::Bulk::Client.new(restforce_client)
job = bulk_client.create_job(:query, 'Account', :csv)
I have a multi-tenant application, and need to create Batch Jobs for many different Salesforce organizations, which means many different Restforce clients. It would be great if the Job creation API supported that, as it's effectively hard-coded to
Restforce::Bulk.clientas far as I can tell.From what I can tell, I can do it by basically re-implementing
Restforce::Bulk::Job::create, but that isn't very clean:Almost seems like that should be: