Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/restforce/bulk/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion lib/restforce/bulk/builder/xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions lib/restforce/bulk/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/restforce/bulk/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Restforce
module Bulk
VERSION = "0.1.0"
VERSION = "0.1.4"
end
end
4 changes: 2 additions & 2 deletions restforce-bulk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down