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/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..164bf31 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) @@ -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) 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..3b1c845 100644 --- a/restforce-bulk.gemspec +++ b/restforce-bulk.gemspec @@ -19,10 +19,10 @@ 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" + spec.add_dependency "activesupport", "> 4.2.4" spec.add_dependency "rubyzip", "~> 1.1.7" spec.add_development_dependency "bundler", "~> 1.10"