Class: Bulkforce
- Inherits:
-
Object
show all
- Defined in:
- lib/bulkforce.rb,
lib/bulkforce/http.rb,
lib/bulkforce/batch.rb,
lib/bulkforce/helper.rb,
lib/bulkforce/version.rb,
lib/bulkforce/connection.rb,
lib/bulkforce/configuration.rb,
lib/bulkforce/connection_builder.rb
Defined Under Namespace
Modules: Helper, Http
Classes: Batch, Configuration, Connection, ConnectionBuilder
Constant Summary
collapse
- SALESFORCE_API_VERSION =
"33.0"
- VERSION =
"1.0.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Bulkforce
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/bulkforce.rb', line 17
def initialize(options = {})
configuration = self.class.configuration || Configuration.new
merged_opts = configuration.to_h.merge(options)
unless merged_opts[:host] =~ /salesforce.com\/?$/
warn("WARNING: You are submitting credentials to a host other than salesforce.com")
end
@connection = Bulkforce::ConnectionBuilder.new(merged_opts).build
end
|
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
14
15
16
|
# File 'lib/bulkforce.rb', line 14
def configuration
@configuration
end
|
Class Method Details
60
61
62
63
|
# File 'lib/bulkforce.rb', line 60
def self.configure(&block)
self.configuration = Configuration.new
block.call(self.configuration)
end
|
Instance Method Details
#delete(sobject, records) ⇒ Object
44
45
46
|
# File 'lib/bulkforce.rb', line 44
def delete(sobject, records)
start_job("delete", sobject, records)
end
|
#insert(sobject, records) ⇒ Object
40
41
42
|
# File 'lib/bulkforce.rb', line 40
def insert(sobject, records)
start_job("insert", sobject, records)
end
|
#org_id ⇒ Object
28
29
30
|
# File 'lib/bulkforce.rb', line 28
def org_id
@connection.org_id
end
|
#query(sobject, query) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/bulkforce.rb', line 48
def query(sobject, query)
job_id = @connection.create_job(
"query",
sobject,
"CSV",
nil)
batch_id = @connection.add_query(job_id, query)
@connection.close_job job_id
batch_reference = Bulkforce::Batch.new @connection, job_id, batch_id
batch_reference.final_status
end
|
#update(sobject, records) ⇒ Object
36
37
38
|
# File 'lib/bulkforce.rb', line 36
def update(sobject, records)
start_job("update", sobject, records)
end
|
#upsert(sobject, records, external_field) ⇒ Object
32
33
34
|
# File 'lib/bulkforce.rb', line 32
def upsert(sobject, records, external_field)
start_job("upsert", sobject, records, external_field)
end
|