From 42851cdb7d5127523304f37493186cf70a3d7ec4 Mon Sep 17 00:00:00 2001 From: Christopher Webber Date: Sun, 14 Aug 2016 07:50:16 -0700 Subject: [PATCH 1/3] Allow the passing through of options This allows us to pass through options to the various objects and then results in us being able to add known fields to the job when appropriate. Signed-off-by: Christopher Webber --- lib/restforce/bulk/builder/xml.rb | 6 +++++- lib/restforce/bulk/job.rb | 4 ++-- lib/restforce/bulk/version.rb | 2 +- restforce-bulk.gemspec | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/restforce/bulk/builder/xml.rb b/lib/restforce/bulk/builder/xml.rb index 3e31f34..6ca9fea 100644 --- a/lib/restforce/bulk/builder/xml.rb +++ b/lib/restforce/bulk/builder/xml.rb @@ -4,14 +4,18 @@ module Builder class Xml attr_accessor :operation - def initialize(operation) + def initialize(operation,options={}) self.operation = operation + @options = options end def job(object_name, content_type) build_xml(:jobInfo) do |xml| xml.operation operation xml.object object_name + if @options[:externalIdFieldName] + xml.externalIdFieldName @options[:externalIdFieldName] + end xml.contentType content_type end end diff --git a/lib/restforce/bulk/job.rb b/lib/restforce/bulk/job.rb index 21e7212..0167074 100644 --- a/lib/restforce/bulk/job.rb +++ b/lib/restforce/bulk/job.rb @@ -11,8 +11,8 @@ class Job } class << self - def create(operation, object_name, content_type=:xml) - builder = Restforce::Bulk::Builder::Xml.new(operation) + def create(operation, object_name, content_type=:xml, options={}) + builder = Restforce::Bulk::Builder::Xml.new(operation, options) data = builder.job(object_name, JOB_CONTENT_TYPE_MAPPING[content_type.to_sym]) response = Restforce::Bulk.client.perform_request(:post, 'job', data) diff --git a/lib/restforce/bulk/version.rb b/lib/restforce/bulk/version.rb index c642457..4f8d849 100644 --- a/lib/restforce/bulk/version.rb +++ b/lib/restforce/bulk/version.rb @@ -1,5 +1,5 @@ module Restforce module Bulk - VERSION = "0.1.0" + VERSION = "0.1.4" end end diff --git a/restforce-bulk.gemspec b/restforce-bulk.gemspec index 024bfa4..21e2dcd 100644 --- a/restforce-bulk.gemspec +++ b/restforce-bulk.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "restforce", "~> 2.1.2" + spec.add_dependency "restforce", "~> 2.1" spec.add_dependency "nokogiri" spec.add_dependency "multi_xml" spec.add_dependency "activesupport", "~> 4.2.4" From 077ea87316967bd64ad69d878044617cf8369176 Mon Sep 17 00:00:00 2001 From: Deployment Date: Fri, 10 Feb 2017 09:19:17 -0600 Subject: [PATCH 2/3] Add more detail to job/batch return values This is useful for automated processes that want to report the status of records updated or failed. --- lib/restforce/bulk/batch.rb | 3 ++- lib/restforce/bulk/job.rb | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/restforce/bulk/batch.rb b/lib/restforce/bulk/batch.rb index a38c132..c08c09d 100644 --- a/lib/restforce/bulk/batch.rb +++ b/lib/restforce/bulk/batch.rb @@ -21,7 +21,8 @@ def builder_class_for(content_type) end end - attr_accessor :id, :job_id, :state, :created_date, :system_modstamp, :number_records_processed + attr_accessor :id, :job_id, :state, :created_date, :system_modstamp, + :number_records_processed, :number_records_failed def initialize(attributes={}) assign_attributes(attributes) diff --git a/lib/restforce/bulk/job.rb b/lib/restforce/bulk/job.rb index 0167074..164bf31 100644 --- a/lib/restforce/bulk/job.rb +++ b/lib/restforce/bulk/job.rb @@ -28,7 +28,11 @@ def find(id) end attr_accessor :id, :operation, :object, :created_by_id, :created_date, - :system_modstamp, :state, :content_type + :system_modstamp, :state, :content_type, :number_records_processed, + :number_records_failed, :number_batches_in_progress, + :number_batches_completed, :number_batches_failed, + :number_batches_total + def initialize(attributes={}) assign_attributes(attributes) From 39c859b8ae602a8d978e9ea5963b673aa7464636 Mon Sep 17 00:00:00 2001 From: Deployment Date: Fri, 8 Sep 2017 09:29:27 -0500 Subject: [PATCH 3/3] Update activesupport dep for Rails 5 --- restforce-bulk.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restforce-bulk.gemspec b/restforce-bulk.gemspec index 21e2dcd..3b1c845 100644 --- a/restforce-bulk.gemspec +++ b/restforce-bulk.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.add_dependency "restforce", "~> 2.1" spec.add_dependency "nokogiri" spec.add_dependency "multi_xml" - spec.add_dependency "activesupport", "~> 4.2.4" + spec.add_dependency "activesupport", "> 4.2.4" spec.add_dependency "rubyzip", "~> 1.1.7" spec.add_development_dependency "bundler", "~> 1.10"