Class: Executrix::Api
- Inherits:
-
Object
- Object
- Executrix::Api
- Defined in:
- lib/executrix.rb
Constant Summary collapse
- SALESFORCE_API_VERSION =
'28.0'
Instance Method Summary collapse
- #delete(sobject, records) ⇒ Object
-
#initialize(username, password, sandbox = false, api_version = SALESFORCE_API_VERSION) ⇒ Api
constructor
A new instance of Api.
- #insert(sobject, records) ⇒ Object
- #org_id ⇒ Object
- #query(sobject, query) ⇒ Object
- #update(sobject, records) ⇒ Object
- #upsert(sobject, records, external_field) ⇒ Object
Constructor Details
#initialize(username, password, sandbox = false, api_version = SALESFORCE_API_VERSION) ⇒ Api
Returns a new instance of Api.
12 13 14 15 16 17 18 |
# File 'lib/executrix.rb', line 12 def initialize(username, password, sandbox = false, api_version = SALESFORCE_API_VERSION) @connection = Executrix::Connection.connect( username, password, api_version, sandbox) end |
Instance Method Details
#delete(sobject, records) ⇒ Object
36 37 38 |
# File 'lib/executrix.rb', line 36 def delete(sobject, records) start_job('delete', sobject, records) end |
#insert(sobject, records) ⇒ Object
32 33 34 |
# File 'lib/executrix.rb', line 32 def insert(sobject, records) start_job('insert', sobject, records) end |
#org_id ⇒ Object
20 21 22 |
# File 'lib/executrix.rb', line 20 def org_id @connection.org_id end |
#query(sobject, query) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/executrix.rb', line 40 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 = Executrix::Batch.new @connection, job_id, batch_id batch_reference.final_status end |
#update(sobject, records) ⇒ Object
28 29 30 |
# File 'lib/executrix.rb', line 28 def update(sobject, records) start_job('update', sobject, records) end |
#upsert(sobject, records, external_field) ⇒ Object
24 25 26 |
# File 'lib/executrix.rb', line 24 def upsert(sobject, records, external_field) start_job('upsert', sobject, records, external_field) end |