salesforcebulk 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ script: "bundle exec rake test"
3
+ rvm:
4
+ - 1.9.3
5
+ - 1.9.2
6
+ notifications:
7
+ email:
8
+ on_success: always
9
+ on_failure: always
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- Salesforce Bulk is a simple Ruby gem for connecting to and using the [Salesforce Bulk API](http://www.salesforce.com/us/developer/docs/api_asynch/index.htm). This is a rewrite of Jorge Valdivia's salesforce_bulk gem with unit tests and full API capability.
5
+ SalesforceBulk is an easy to use Ruby gem for connecting to and using the [Salesforce Bulk API](http://www.salesforce.com/us/developer/docs/api_asynch/index.htm). This is a rewrite and separate release of Jorge Valdivia's salesforce_bulk gem (renamed `salesforcebulk`) with full unit tests and full API capability (e.g. adding multiple batches per job). This gem was built on Ruby 1.9.2 and 1.9.3. Unless requested or contributed, no support for Ruby 1.8.7 is planned.
6
6
 
7
7
  ## Installation
8
8
 
@@ -16,7 +16,7 @@ Or include it in your project's `Gemfile` with Bundler:
16
16
 
17
17
  ## Contribute
18
18
 
19
- To contribute, fork this repo, create a topic branch, make changes, then send a pull request. Pull requests without accompanying tests will *not* be accepted. To run tests in your fork, just do:
19
+ To contribute, fork this repo, create a topic branch, make changes, then send a pull request. Pull requests without accompanying tests will *not* be accepted. If you need help creating tests let me know and I'll help out. To setup the project and run tests in your fork, just do:
20
20
 
21
21
  bundle install
22
22
  rake
@@ -25,21 +25,24 @@ To contribute, fork this repo, create a topic branch, make changes, then send a
25
25
 
26
26
  ### Basic Configuration
27
27
 
28
+ When retrieving a password you will also be given a security token. Combine the two into a single value as the API treats this as your real password.
29
+
28
30
  require 'salesforce_bulk'
29
31
 
30
- client = SalesforceBulk::Client.new(username: 'MyUsername', password: 'MyPassword', token: 'MySecurityToken')
32
+ client = SalesforceBulk::Client.new(username: 'MyUsername', password: 'MyPasswordWithSecurtyToken')
31
33
  client.authenticate
32
34
 
33
- Optional keys include host (default: login.salesforce.com), version (default: 24.0) and debugging (default: false).
35
+ Optional keys include `login_host` (default is 'login.salesforce.com') and `version` (default is '24.0').
34
36
 
35
37
  ### Configuring from a YAML file
36
38
 
37
- The optional keys mentioned in the Basic Configuration section can also be used here.
39
+ Create a YAML file with the content below. Only `username` and `password` is required.
38
40
 
39
41
  ---
40
42
  username: MyUsername
41
43
  password: MyPassword
42
- token: MySecurityToken
44
+ login_host: login.salesforce.com # default
45
+ version: 24.0 # default
43
46
 
44
47
  Then in a Ruby script:
45
48
 
@@ -50,7 +53,7 @@ Then in a Ruby script:
50
53
 
51
54
  ## Usage Examples
52
55
 
53
- An important note about the data in any of the examples: each hash in a data set must have the same set of keys. If you need to have logic to not include certain values simply specify a nil value for a key.
56
+ An important note about the data in any of the examples below: each hash in a data set must have the same set of keys. If you need to have logic to not include certain values simply specify a nil value for a key rather than not including the key-value pair.
54
57
 
55
58
  ### Basic Overall Example
56
59
 
@@ -78,35 +81,39 @@ When using the :upsert operation you must specify an external ID field name:
78
81
 
79
82
  job = client.add_job(:upsert, :MyObject__c, :external_id_field_name => :MyId__c)
80
83
 
81
- For any operation you should be able to specify a concurrency mode. The default is Parallel. The other choice is Serial.
84
+ For any operation you should be able to specify a concurrency mode. The default is `Parallel`. The only other choice is `Serial`.
82
85
 
83
86
  job = client.add_job(:upsert, :MyObject__c, :concurrency_mode => :Serial, :external_id_field_name => :MyId__c)
84
87
 
85
88
  ### Retrieving Job Information (e.g. Status)
86
89
 
90
+ The Job object has various properties such as status, created time, number of completed and failed batches and various other values.
91
+
87
92
  job = client.job_info(jobId) # returns a Job object
88
93
 
89
94
  puts "Job #{job.id} is closed." if job.closed? # other: open?, aborted?
90
95
 
96
+ ### Retrieving Info for a single Batch
97
+
98
+ The Batch object has various properties such as status, created time, number of processed and failed records and various other values.
99
+
100
+ batch = client.batch_info(jobId, batchId) # returns a Batch object
101
+
102
+ puts "Batch #{batch.id} is in progress." if batch.in_progress?
103
+
91
104
  ### Retrieving Info for all Batches
92
105
 
93
106
  batches = client.batch_info_list(jobId) # returns an Array of Batch objects
94
107
 
95
108
  batches.each do |batch|
96
- puts "Batch #{batch.id} failed." if batch.failed? # other: completed?, failed?, in_progress?, queued?
109
+ puts "Batch #{batch.id} completed." if batch.completed? # other: failed?, in_progress?, queued?
97
110
  end
98
111
 
99
- ### Retrieving Info for a single Batch
100
-
101
- batch = client.batch_info(jobId, batchId) # returns a Batch object
102
-
103
- puts "Batch #{batch.id} is in progress." if batch.in_progress?
104
-
105
112
  ### Retrieving Batch Results (for Delete, Insert, Update and Upsert)
106
113
 
107
114
  To verify that a batch completed successfully or failed call the `batch_info` or `batch_info_list` methods first, otherwise if you call `batch_result` without verifying and the batch failed the method will raise an error.
108
115
 
109
- The object returned from the following example only applies to the operations: delete, insert, update and upsert. Query results are handled differently.
116
+ The object returned from the following example only applies to the operations: `delete`, `insert`, `update` and `upsert`. Query results are handled differently.
110
117
 
111
118
  results = client.batch_result(jobId, batchId) # returns an Array of BatchResult objects
112
119
 
@@ -118,7 +125,7 @@ The object returned from the following example only applies to the operations: d
118
125
 
119
126
  To verify that a batch completed successfully or failed call the `batch_info` or `batch_info_list` methods first, otherwise if you call `batch_result` without verifying and the batch failed the method will raise an error.
120
127
 
121
- Query results are handled differently as the response will not contain the full result set. You'll have to page through sets if you added multiple batches to a job.
128
+ Query results are handled differently as its possible that a single batch could return multiple results if objects returned are large enough. Note: I haven't been able to replicate this behavior but in a fork by @WWJacob has [discovered that multiple results can be returned](https://github.com/WWJacob/salesforce_bulk/commit/8f9e68c390230e885823e45cd2616ac3159697ef).
122
129
 
123
130
  # returns a QueryResultCollection object (an Array)
124
131
  results = client.batch_result(jobId, batchId)
@@ -1,11 +1,8 @@
1
1
  module SalesforceBulk
2
2
  # Interface for operating the Salesforce Bulk REST API
3
3
  class Client
4
- # If true, print API debugging information to stdout. Defaults to false.
5
- attr_accessor :debugging
6
-
7
4
  # The host to use for authentication. Defaults to login.salesforce.com.
8
- attr_accessor :host
5
+ attr_accessor :login_host
9
6
 
10
7
  # The instance host to use for API calls. Determined from login response.
11
8
  attr_accessor :instance_host
@@ -13,9 +10,6 @@ module SalesforceBulk
13
10
  # The Salesforce password
14
11
  attr_accessor :password
15
12
 
16
- # The Salesforce security token
17
- attr_accessor :token
18
-
19
13
  # The Salesforce username
20
14
  attr_accessor :username
21
15
 
@@ -28,18 +22,16 @@ module SalesforceBulk
28
22
  options.symbolize_keys!
29
23
  end
30
24
 
31
- options = {:debugging => false, :host => 'login.salesforce.com', :version => 24.0}.merge(options)
25
+ options = {:login_host => 'login.salesforce.com', :version => 24.0}.merge(options)
32
26
 
33
- options.assert_valid_keys(:username, :password, :token, :debugging, :host, :version)
27
+ options.assert_valid_keys(:username, :password, :login_host, :version)
34
28
 
35
29
  self.username = options[:username]
36
- self.password = "#{options[:password]}#{options[:token]}"
37
- self.token = options[:token]
38
- self.debugging = options[:debugging]
39
- self.host = options[:host]
30
+ self.password = "#{options[:password]}"
31
+ self.login_host = options[:login_host]
40
32
  self.version = options[:version]
41
33
 
42
- @api_path_prefix = "/services/async/#{self.version}/"
34
+ @api_path_prefix = "/services/async/#{version}/"
43
35
  @valid_operations = [:delete, :insert, :update, :upsert, :query]
44
36
  @valid_concurrency_modes = ['Parallel', 'Serial']
45
37
  end
@@ -51,20 +43,21 @@ module SalesforceBulk
51
43
  xml += ' xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">'
52
44
  xml += "<env:Body>"
53
45
  xml += '<n1:login xmlns:n1="urn:partner.soap.sforce.com">'
54
- xml += "<n1:username>#{self.username}</n1:username>"
55
- xml += "<n1:password>#{self.password}</n1:password>"
46
+ xml += "<n1:username>#{username}</n1:username>"
47
+ xml += "<n1:password>#{password}</n1:password>"
56
48
  xml += "</n1:login>"
57
49
  xml += "</env:Body>"
58
- xml += "</env:Envelope>"
50
+ xml += "</env:Envelope>\n"
59
51
 
60
- response = http_post("/services/Soap/u/#{self.version}", xml, 'Content-Type' => 'text/xml', 'SOAPAction' => 'login')
52
+ response = http_post("/services/Soap/u/#{version}", xml, 'Content-Type' => 'text/xml', 'SOAPAction' => 'login')
61
53
 
62
- data = XmlSimple.xml_in(response.body, :ForceArray => false)
54
+ data = XmlSimple.xml_in(response.body, 'ForceArray' => false)
63
55
  result = data['Body']['loginResponse']['result']
64
56
 
65
57
  @session_id = result['sessionId']
66
58
 
67
59
  self.instance_host = "#{instance_id(result['serverUrl'])}.salesforce.com"
60
+ self
68
61
  end
69
62
 
70
63
  def abort_job(jobId)
@@ -74,7 +67,7 @@ module SalesforceBulk
74
67
  xml += "</jobInfo>"
75
68
 
76
69
  response = http_post("job/#{jobId}", xml)
77
- data = XmlSimple.xml_in(response.body, :ForceArray => false)
70
+ data = XmlSimple.xml_in(response.body, 'ForceArray' => false)
78
71
  Job.new_from_xml(data)
79
72
  end
80
73
 
@@ -122,7 +115,7 @@ module SalesforceBulk
122
115
  xml += "</jobInfo>"
123
116
 
124
117
  response = http_post("job", xml)
125
- data = XmlSimple.xml_in(response.body, :ForceArray => false)
118
+ data = XmlSimple.xml_in(response.body, 'ForceArray' => false)
126
119
  job = Job.new_from_xml(data)
127
120
  end
128
121
 
@@ -192,25 +185,25 @@ module SalesforceBulk
192
185
  xml += "</jobInfo>"
193
186
 
194
187
  response = http_post("job/#{jobId}", xml)
195
- data = XmlSimple.xml_in(response.body, :ForceArray => false)
188
+ data = XmlSimple.xml_in(response.body, 'ForceArray' => false)
196
189
  Job.new_from_xml(data)
197
190
  end
198
191
 
199
192
  def job_info(jobId)
200
193
  response = http_get("job/#{jobId}")
201
- data = XmlSimple.xml_in(response.body, :ForceArray => false)
194
+ data = XmlSimple.xml_in(response.body, 'ForceArray' => false)
202
195
  Job.new_from_xml(data)
203
196
  end
204
197
 
205
198
  def http_post(path, body, headers={})
206
- host = self.host
207
-
208
199
  headers = {'Content-Type' => 'application/xml'}.merge(headers)
209
200
 
210
201
  if @session_id
211
202
  headers['X-SFDC-Session'] = @session_id
212
- host = self.instance_host
203
+ host = instance_host
213
204
  path = "#{@api_path_prefix}#{path}"
205
+ else
206
+ host = self.login_host
214
207
  end
215
208
 
216
209
  response = https_request(host).post(path, body, headers)
@@ -251,4 +244,4 @@ module SalesforceBulk
251
244
  url.match(/:\/\/([a-zA-Z0-9-]{2,}).salesforce/)[1]
252
245
  end
253
246
  end
254
- end
247
+ end
@@ -1,3 +1,3 @@
1
1
  module SalesforceBulk
2
- VERSION = "1.0.1"
3
- end
2
+ VERSION = "1.1.0"
3
+ end
@@ -18,11 +18,12 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency "active_support"
21
+ s.add_dependency "activesupport"
22
22
  s.add_dependency "xml-simple"
23
23
 
24
- s.add_development_dependency "mocha"
25
24
  s.add_development_dependency "rake"
25
+ s.add_development_dependency "rdoc"
26
+ s.add_development_dependency "mocha"
26
27
  s.add_development_dependency "shoulda"
27
28
  s.add_development_dependency "webmock"
28
29
 
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  username: MyUsername
3
3
  password: MyPassword
4
- token: MySecurityToken
5
- debugging: true
6
- host: myhost.mydomain.com
7
- version: 88.0
4
+ login_host: myhost.mydomain.com
5
+ version: 88.0
@@ -1 +1 @@
1
- <?xml version="1.0" encoding="utf-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><n1:login xmlns:n1="urn:partner.soap.sforce.com"><n1:username>MyUsername</n1:username><n1:password>MyPasswordMySecurityToken</n1:password></n1:login></env:Body></env:Envelope>
1
+ <?xml version="1.0" encoding="utf-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><n1:login xmlns:n1="urn:partner.soap.sforce.com"><n1:username>MyUsername</n1:username><n1:password>MyPassword</n1:password></n1:login></env:Body></env:Envelope>
@@ -5,8 +5,7 @@ class TestBatch < Test::Unit::TestCase
5
5
  def setup
6
6
  options = {
7
7
  :username => 'myusername',
8
- :password => 'mypassword',
9
- :token => "somelongtoken"
8
+ :password => 'mypassword'
10
9
  }
11
10
 
12
11
  @client = SalesforceBulk::Client.new(options)
@@ -85,9 +84,7 @@ class TestBatch < Test::Unit::TestCase
85
84
  {:Id__c => '23456', :Title__c => "A second test!", :IsPreview__c => true}
86
85
  ]
87
86
 
88
- stub_request(:post, "#{api_url(@client)}job/#{job_id}/batch")
89
- .with(:body => request, :headers => @headers)
90
- .to_return(:body => response, :status => 200)
87
+ stub_request(:post, "#{api_url(@client)}job/#{job_id}/batch").with(:body => request, :headers => @headers).to_return(:body => response, :status => 200)
91
88
 
92
89
  batch = @client.add_batch(job_id, data)
93
90
 
@@ -157,9 +154,7 @@ class TestBatch < Test::Unit::TestCase
157
154
  job_id = "750E00000004N97IAE"
158
155
  batch_id = "751E00000004ZRbIAM"
159
156
 
160
- stub_request(:get, "#{api_url(@client)}job/#{job_id}/batch/#{batch_id}")
161
- .with(:headers => @headersWithXml)
162
- .to_return(:body => response, :status => 200)
157
+ stub_request(:get, "#{api_url(@client)}job/#{job_id}/batch/#{batch_id}").with(:headers => @headersWithXml).to_return(:body => response, :status => 200)
163
158
 
164
159
  batch = @client.batch_info(job_id, batch_id)
165
160
 
@@ -209,9 +204,7 @@ class TestBatch < Test::Unit::TestCase
209
204
  batch_id = "751E00000004aEY"
210
205
  result_id = "752E0000000TNaq"
211
206
 
212
- stub_request(:get, "#{api_url(@client)}job/#{job_id}/batch/#{batch_id}/result")
213
- .with(:headers => @headersWithXml)
214
- .to_return(:body => response, :status => 200)
207
+ stub_request(:get, "#{api_url(@client)}job/#{job_id}/batch/#{batch_id}/result").with(:headers => @headersWithXml).to_return(:body => response, :status => 200)
215
208
 
216
209
  @client.expects(:query_result).with(job_id, batch_id, result_id).returns([])
217
210
 
@@ -230,9 +223,7 @@ class TestBatch < Test::Unit::TestCase
230
223
  batch_id = "751E00000004aEY"
231
224
  result_id = "752E0000000TNaq"
232
225
 
233
- stub_request(:get, "#{api_url(@client)}job/#{job_id}/batch/#{batch_id}/result/#{result_id}")
234
- .with(:headers => @headers)
235
- .to_return(:body => response, :status => 200)
226
+ stub_request(:get, "#{api_url(@client)}job/#{job_id}/batch/#{batch_id}/result/#{result_id}").with(:headers => @headers).to_return(:body => response, :status => 200)
236
227
 
237
228
  result = @client.query_result(job_id, batch_id, result_id)
238
229
 
@@ -246,9 +237,7 @@ class TestBatch < Test::Unit::TestCase
246
237
  job_id = "750E00000004NnR"
247
238
  batch_id = "751E00000004aEY"
248
239
 
249
- stub_request(:get, "#{api_url(@client)}job/#{job_id}/batch/#{batch_id}/result")
250
- .with(:headers => @headersWithXml)
251
- .to_return(:body => response, :status => 400)
240
+ stub_request(:get, "#{api_url(@client)}job/#{job_id}/batch/#{batch_id}/result").with(:headers => @headersWithXml).to_return(:body => response, :status => 400)
252
241
 
253
242
  assert_raise SalesforceBulk::SalesforceError do
254
243
  @client.batch_result(job_id, batch_id)
@@ -19,10 +19,6 @@ class TestBatchResult < Test::Unit::TestCase
19
19
  assert_equal @result_created.updated?, false
20
20
  end
21
21
 
22
- test "initialization from CSV row" do
23
- #@br = SalesforceBulk::BatchResult.new_from_csv()
24
- end
25
-
26
22
  test "error?" do
27
23
  assert @result_failed.error?
28
24
 
@@ -6,7 +6,6 @@ class TestInitialization < Test::Unit::TestCase
6
6
  @options = {
7
7
  :username => 'MyUsername',
8
8
  :password => 'MyPassword',
9
- :token => 'MySecurityToken'
10
9
  }
11
10
 
12
11
  @client = SalesforceBulk::Client.new(@options)
@@ -15,35 +14,29 @@ class TestInitialization < Test::Unit::TestCase
15
14
  test "initialization with default values" do
16
15
  assert_not_nil @client
17
16
  assert_equal @client.username, @options[:username]
18
- assert_equal @client.password, "#{@options[:password]}#{@options[:token]}"
19
- assert_equal @client.token, @options[:token]
20
- assert_equal @client.host, 'login.salesforce.com'
17
+ assert_equal @client.password, @options[:password]
18
+ assert_equal @client.login_host, 'login.salesforce.com'
21
19
  assert_equal @client.version, 24.0
22
- assert_equal @client.debugging, false
23
20
  end
24
21
 
25
22
  test "initialization overriding all default values" do
26
- @options.merge!({:debugging => true, :host => 'newhost.salesforce.com', :version => 1.0})
23
+ @options.merge!({:login_host => 'newhost.salesforce.com', :version => 1.0})
27
24
 
28
25
  client = SalesforceBulk::Client.new(@options)
29
26
 
30
- assert_equal client.username, @options[:username]
31
- assert_equal client.password, "#{@options[:password]}#{@options[:token]}"
32
- assert_equal client.token, @options[:token]
33
- assert_equal client.debugging, @options[:debugging]
34
- assert_equal client.host, @options[:host]
35
- assert_equal client.version, @options[:version]
27
+ assert_equal client.username, @options[:username]
28
+ assert_equal client.password, @options[:password]
29
+ assert_equal client.login_host, @options[:login_host]
30
+ assert_equal client.version, @options[:version]
36
31
  end
37
32
 
38
33
  test "initialization with a YAML file" do
39
34
  client = SalesforceBulk::Client.new(fixture_path('config.yml'))
40
35
 
41
- assert_equal client.username, 'MyUsername'
42
- assert_equal client.password, 'MyPasswordMySecurityToken'
43
- assert_equal client.token, 'MySecurityToken'
44
- assert_equal client.debugging, true
45
- assert_equal client.host, 'myhost.mydomain.com'
46
- assert_equal client.version, 88.0
36
+ assert_equal client.username, 'MyUsername'
37
+ assert_equal client.password, 'MyPassword'
38
+ assert_equal client.login_host, 'myhost.mydomain.com'
39
+ assert_equal client.version, 88.0
47
40
  end
48
41
 
49
42
  test "initialization with invalid key raises ArgumentError" do
@@ -57,16 +50,15 @@ class TestInitialization < Test::Unit::TestCase
57
50
  request = fixture("login_request.xml")
58
51
  response = fixture("login_response.xml")
59
52
 
60
- stub_request(:post, "https://#{@client.host}/services/Soap/u/24.0")
61
- .with(:body => request, :headers => headers)
62
- .to_return(:body => response, :status => 200)
53
+ stub_request(:post, "https://#{@client.login_host}/services/Soap/u/24.0").with(:body => request, :headers => headers).to_return(:body => response, :status => 200)
63
54
 
64
- @client.authenticate()
55
+ result = @client.authenticate()
65
56
 
66
- assert_requested :post, "https://#{@client.host}/services/Soap/u/24.0", :body => request, :headers => headers, :times => 1
57
+ assert_requested :post, "https://#{@client.login_host}/services/Soap/u/24.0", :body => request, :headers => headers, :times => 1
67
58
 
68
59
  assert_equal @client.instance_host, 'na9-api.salesforce.com'
69
60
  assert_equal @client.instance_variable_get('@session_id'), '00DE0000000YSKp!AQ4AQNQhDKLMORZx2NwZppuKfure.ChCmdI3S35PPxpNA5MHb3ZVxhYd5STM3euVJTI5.39s.jOBT.3mKdZ3BWFDdIrddS8O'
61
+ assert_equal @client, result
70
62
  end
71
63
 
72
64
  test "parsing instance id from server url" do
data/test/lib/test_job.rb CHANGED
@@ -5,8 +5,7 @@ class TestJob < Test::Unit::TestCase
5
5
  def setup
6
6
  options = {
7
7
  :username => 'myusername',
8
- :password => 'mypassword',
9
- :token => "somelongtoken"
8
+ :password => 'mypassword'
10
9
  }
11
10
 
12
11
  @client = SalesforceBulk::Client.new(options)
@@ -83,9 +82,7 @@ class TestJob < Test::Unit::TestCase
83
82
  request = fixture("job_create_request.xml")
84
83
  response = fixture("job_create_response.xml")
85
84
 
86
- stub_request(:post, "#{api_url(@client)}job")
87
- .with(:body => request, :headers => @headers)
88
- .to_return(:body => response, :status => 200)
85
+ stub_request(:post, "#{api_url(@client)}job").with(:body => request, :headers => @headers).to_return(:body => response, :status => 200)
89
86
 
90
87
  job = @client.add_job(:upsert, :VideoEvent__c, :external_id_field_name => :Id__c)
91
88
 
@@ -138,9 +135,7 @@ class TestJob < Test::Unit::TestCase
138
135
  response = fixture("job_close_response.xml")
139
136
  job_id = "750E00000004MzbIAE"
140
137
 
141
- stub_request(:post, "#{api_url(@client)}job/#{job_id}")
142
- .with(:body => request, :headers => @headers)
143
- .to_return(:body => response, :status => 200)
138
+ stub_request(:post, "#{api_url(@client)}job/#{job_id}").with(:body => request, :headers => @headers).to_return(:body => response, :status => 200)
144
139
 
145
140
  job = @client.close_job(job_id)
146
141
 
@@ -175,9 +170,7 @@ class TestJob < Test::Unit::TestCase
175
170
  response = fixture("job_abort_response.xml")
176
171
  job_id = "750E00000004N1NIAU"
177
172
 
178
- stub_request(:post, "#{api_url(@client)}job/#{job_id}")
179
- .with(:body => request, :headers => @headers)
180
- .to_return(:body => response, :status => 200)
173
+ stub_request(:post, "#{api_url(@client)}job/#{job_id}").with(:body => request, :headers => @headers).to_return(:body => response, :status => 200)
181
174
 
182
175
  job = @client.abort_job(job_id)
183
176
 
@@ -211,9 +204,7 @@ class TestJob < Test::Unit::TestCase
211
204
  response = fixture("job_info_response.xml")
212
205
  job_id = "750E00000004N1mIAE"
213
206
 
214
- stub_request(:get, "#{api_url(@client)}job/#{job_id}")
215
- .with(:body => '', :headers => @headers)
216
- .to_return(:body => response, :status => 200)
207
+ stub_request(:get, "#{api_url(@client)}job/#{job_id}").with(:body => '', :headers => @headers).to_return(:body => response, :status => 200)
217
208
 
218
209
  job = @client.job_info(job_id)
219
210
 
@@ -5,8 +5,7 @@ class TestQueryResultCollection < Test::Unit::TestCase
5
5
  def setup
6
6
  options = {
7
7
  :username => 'myusername',
8
- :password => 'mypassword',
9
- :token => "somelongtoken"
8
+ :password => 'mypassword'
10
9
  }
11
10
 
12
11
  @client = SalesforceBulk::Client.new(options)
@@ -84,4 +83,4 @@ class TestQueryResultCollection < Test::Unit::TestCase
84
83
  assert !@collection.previous.any?
85
84
  end
86
85
 
87
- end
86
+ end
data/test/test_helper.rb CHANGED
@@ -12,12 +12,12 @@ class Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def api_url(client)
15
- "https://#{client.host}/services/async/#{client.version}/"
15
+ "https://#{client.login_host}/services/async/#{client.version}/"
16
16
  end
17
17
 
18
18
  def bypass_authentication(client)
19
19
  client.instance_variable_set('@session_id', '123456789')
20
- client.instance_variable_set('@host', 'na9.salesforce.com')
20
+ client.instance_variable_set('@login_host', 'na9.salesforce.com')
21
21
  client.instance_variable_set('@instance_host', 'na9.salesforce.com')
22
22
  end
23
23
 
@@ -29,4 +29,4 @@ class Test::Unit::TestCase
29
29
  File.new(fixture_path(file)).read
30
30
  end
31
31
 
32
- end
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforcebulk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-17 00:00:00.000000000 Z
12
+ date: 2012-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: active_support
15
+ name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
@@ -44,7 +44,7 @@ dependencies:
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
- name: mocha
47
+ name: rake
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
@@ -60,7 +60,23 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
- name: rake
63
+ name: rdoc
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: mocha
64
80
  requirement: !ruby/object:Gem::Requirement
65
81
  none: false
66
82
  requirements:
@@ -117,6 +133,7 @@ extra_rdoc_files: []
117
133
  files:
118
134
  - .gitignore
119
135
  - .rbenv-version
136
+ - .travis.yml
120
137
  - Gemfile
121
138
  - README.md
122
139
  - Rakefile
@@ -172,18 +189,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
189
  - - ! '>='
173
190
  - !ruby/object:Gem::Version
174
191
  version: '0'
175
- segments:
176
- - 0
177
- hash: 2697446010810660903
178
192
  required_rubygems_version: !ruby/object:Gem::Requirement
179
193
  none: false
180
194
  requirements:
181
195
  - - ! '>='
182
196
  - !ruby/object:Gem::Version
183
197
  version: '0'
184
- segments:
185
- - 0
186
- hash: 2697446010810660903
187
198
  requirements: []
188
199
  rubyforge_project:
189
200
  rubygems_version: 1.8.24