salesforcebulk 1.4.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +92 -117
- data/lib/salesforce_bulk.rb +2 -10
- data/lib/salesforce_bulk/batch.rb +1 -1
- data/lib/salesforce_bulk/batch_result.rb +11 -11
- data/lib/salesforce_bulk/client.rb +91 -70
- data/lib/salesforce_bulk/job.rb +8 -8
- data/lib/salesforce_bulk/query_result_collection.rb +11 -11
- data/lib/salesforce_bulk/version.rb +1 -1
- metadata +21 -115
- data/.gitignore +0 -4
- data/.travis.yml +0 -10
- data/Gemfile +0 -3
- data/LICENSE +0 -20
- data/Rakefile +0 -22
- data/lib/salesforce_bulk/core_extensions/string.rb +0 -14
- data/salesforcebulk.gemspec +0 -30
- data/test/fixtures/batch_create_request.csv +0 -3
- data/test/fixtures/batch_create_response.xml +0 -13
- data/test/fixtures/batch_info_list_response.xml +0 -27
- data/test/fixtures/batch_info_response.xml +0 -14
- data/test/fixtures/batch_result_list_response.csv +0 -3
- data/test/fixtures/config.yml +0 -5
- data/test/fixtures/invalid_batch_error.xml +0 -5
- data/test/fixtures/invalid_error.xml +0 -5
- data/test/fixtures/invalid_job_error.xml +0 -5
- data/test/fixtures/invalid_session_error.xml +0 -5
- data/test/fixtures/job_abort_request.xml +0 -1
- data/test/fixtures/job_abort_response.xml +0 -25
- data/test/fixtures/job_close_request.xml +0 -1
- data/test/fixtures/job_close_response.xml +0 -25
- data/test/fixtures/job_create_request.xml +0 -1
- data/test/fixtures/job_create_response.xml +0 -25
- data/test/fixtures/job_info_response.xml +0 -25
- data/test/fixtures/login_error.xml +0 -1
- data/test/fixtures/login_request.xml +0 -1
- data/test/fixtures/login_response.xml +0 -39
- data/test/fixtures/query_result_list_response.xml +0 -1
- data/test/fixtures/query_result_response.csv +0 -5
- data/test/lib/test_batch.rb +0 -252
- data/test/lib/test_batch_result.rb +0 -36
- data/test/lib/test_core_extensions.rb +0 -15
- data/test/lib/test_initialization.rb +0 -80
- data/test/lib/test_job.rb +0 -247
- data/test/lib/test_query_result_collection.rb +0 -86
- data/test/test_helper.rb +0 -32
data/lib/salesforce_bulk/job.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module SalesforceBulk
|
2
2
|
class Job
|
3
|
-
|
3
|
+
|
4
4
|
attr_accessor :concurrency_mode
|
5
5
|
attr_accessor :external_id_field_name
|
6
6
|
attr_accessor :id
|
@@ -23,7 +23,7 @@ module SalesforceBulk
|
|
23
23
|
attr_accessor :api_active_processing_time
|
24
24
|
attr_accessor :total_processing_time
|
25
25
|
attr_accessor :api_version
|
26
|
-
|
26
|
+
|
27
27
|
def self.new_from_xml(data)
|
28
28
|
job = self.new
|
29
29
|
job.id = data['id']
|
@@ -40,7 +40,7 @@ module SalesforceBulk
|
|
40
40
|
job.in_progress_batches = data['numberBatchesInProgress'].to_i
|
41
41
|
job.completed_batches = data['numberBatchesCompleted'].to_i
|
42
42
|
job.failed_batches = data['numberBatchesFailed'].to_i
|
43
|
-
job.total_batches = data['
|
43
|
+
job.total_batches = data['numberBatchesTotal'].to_i
|
44
44
|
job.retries = data['retries'].to_i
|
45
45
|
job.processed_records = data['numberRecordsProcessed'].to_i
|
46
46
|
job.failed_records = data['numberRecordsFailed'].to_i
|
@@ -50,21 +50,21 @@ module SalesforceBulk
|
|
50
50
|
job.api_version = data['apiVersion'].to_i
|
51
51
|
job
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def aborted?
|
55
55
|
state? 'Aborted'
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def closed?
|
59
59
|
state? 'Closed'
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def open?
|
63
63
|
state? 'Open'
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
def state?(value)
|
67
|
-
self.state.
|
67
|
+
!self.state.nil? && self.state.casecmp(value) == 0
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module SalesforceBulk
|
2
2
|
class QueryResultCollection < Array
|
3
|
-
|
3
|
+
|
4
4
|
attr_reader :client
|
5
5
|
attr_reader :batch_id
|
6
6
|
attr_reader :job_id
|
7
7
|
attr_reader :result_id
|
8
8
|
attr_reader :result_ids
|
9
|
-
|
9
|
+
|
10
10
|
def initialize(client, job_id, batch_id, result_id=nil, result_ids=[])
|
11
11
|
@client = client
|
12
12
|
@job_id = job_id
|
@@ -15,34 +15,34 @@ module SalesforceBulk
|
|
15
15
|
@result_ids = result_ids
|
16
16
|
@current_index = result_ids.index(result_id) || 0
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def next?
|
20
|
-
|
20
|
+
!@result_ids.nil? && !@result_ids.empty? && @current_index < @result_ids.length - 1
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def next
|
24
24
|
if next?
|
25
25
|
replace(@client.query_result(job_id, batch_id, result_ids[@current_index + 1]))
|
26
26
|
@current_index += 1
|
27
27
|
@result_id = @result_ids[@current_index]
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
self
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def previous?
|
34
|
-
|
34
|
+
!@result_ids.nil? && !@result_ids.empty? && @current_index > 0
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def previous
|
38
38
|
if previous?
|
39
39
|
replace(@client.query_result(job_id, batch_id, result_ids[@current_index - 1]))
|
40
40
|
@current_index -= 1
|
41
41
|
@result_id = @result_ids[@current_index]
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
self
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
end
|
48
48
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: salesforcebulk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Julio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.2.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.2.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: xml-simple
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +39,7 @@ dependencies:
|
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: mocha
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - ">="
|
@@ -67,61 +53,47 @@ dependencies:
|
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.13.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.13.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: shoulda
|
56
|
+
name: webmock
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
86
58
|
requirements:
|
87
|
-
- - "
|
59
|
+
- - ">="
|
88
60
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
61
|
+
version: '0'
|
90
62
|
type: :development
|
91
63
|
prerelease: false
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
93
65
|
requirements:
|
94
|
-
- - "
|
66
|
+
- - ">="
|
95
67
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
68
|
+
version: '0'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
70
|
+
name: minitest
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
100
72
|
requirements:
|
101
|
-
- - "
|
73
|
+
- - ">="
|
102
74
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
75
|
+
version: '0'
|
104
76
|
type: :development
|
105
77
|
prerelease: false
|
106
78
|
version_requirements: !ruby/object:Gem::Requirement
|
107
79
|
requirements:
|
108
|
-
- - "
|
80
|
+
- - ">="
|
109
81
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
82
|
+
version: '0'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: minitest
|
84
|
+
name: minitest-reporters
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
114
86
|
requirements:
|
115
|
-
- - "
|
87
|
+
- - ">="
|
116
88
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
89
|
+
version: '0'
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
93
|
requirements:
|
122
|
-
- - "
|
94
|
+
- - ">="
|
123
95
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
96
|
+
version: '0'
|
125
97
|
description: This gem is a simple interface to the Salesforce Bulk API providing full
|
126
98
|
support for insert, update, upsert, delete, and query actions while allowing you
|
127
99
|
to specify multiple batches per job to process data fast. Gem includes unit tests.
|
@@ -130,52 +102,16 @@ executables: []
|
|
130
102
|
extensions: []
|
131
103
|
extra_rdoc_files: []
|
132
104
|
files:
|
133
|
-
- ".gitignore"
|
134
|
-
- ".travis.yml"
|
135
|
-
- Gemfile
|
136
|
-
- LICENSE
|
137
105
|
- README.md
|
138
|
-
- Rakefile
|
139
106
|
- lib/salesforce_bulk.rb
|
140
107
|
- lib/salesforce_bulk/batch.rb
|
141
108
|
- lib/salesforce_bulk/batch_result.rb
|
142
109
|
- lib/salesforce_bulk/batch_result_collection.rb
|
143
110
|
- lib/salesforce_bulk/client.rb
|
144
|
-
- lib/salesforce_bulk/core_extensions/string.rb
|
145
111
|
- lib/salesforce_bulk/job.rb
|
146
112
|
- lib/salesforce_bulk/query_result_collection.rb
|
147
113
|
- lib/salesforce_bulk/salesforce_error.rb
|
148
114
|
- lib/salesforce_bulk/version.rb
|
149
|
-
- salesforcebulk.gemspec
|
150
|
-
- test/fixtures/batch_create_request.csv
|
151
|
-
- test/fixtures/batch_create_response.xml
|
152
|
-
- test/fixtures/batch_info_list_response.xml
|
153
|
-
- test/fixtures/batch_info_response.xml
|
154
|
-
- test/fixtures/batch_result_list_response.csv
|
155
|
-
- test/fixtures/config.yml
|
156
|
-
- test/fixtures/invalid_batch_error.xml
|
157
|
-
- test/fixtures/invalid_error.xml
|
158
|
-
- test/fixtures/invalid_job_error.xml
|
159
|
-
- test/fixtures/invalid_session_error.xml
|
160
|
-
- test/fixtures/job_abort_request.xml
|
161
|
-
- test/fixtures/job_abort_response.xml
|
162
|
-
- test/fixtures/job_close_request.xml
|
163
|
-
- test/fixtures/job_close_response.xml
|
164
|
-
- test/fixtures/job_create_request.xml
|
165
|
-
- test/fixtures/job_create_response.xml
|
166
|
-
- test/fixtures/job_info_response.xml
|
167
|
-
- test/fixtures/login_error.xml
|
168
|
-
- test/fixtures/login_request.xml
|
169
|
-
- test/fixtures/login_response.xml
|
170
|
-
- test/fixtures/query_result_list_response.xml
|
171
|
-
- test/fixtures/query_result_response.csv
|
172
|
-
- test/lib/test_batch.rb
|
173
|
-
- test/lib/test_batch_result.rb
|
174
|
-
- test/lib/test_core_extensions.rb
|
175
|
-
- test/lib/test_initialization.rb
|
176
|
-
- test/lib/test_job.rb
|
177
|
-
- test/lib/test_query_result_collection.rb
|
178
|
-
- test/test_helper.rb
|
179
115
|
homepage: https://github.com/javierjulio/salesforce_bulk
|
180
116
|
licenses: []
|
181
117
|
metadata: {}
|
@@ -187,45 +123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
123
|
requirements:
|
188
124
|
- - ">="
|
189
125
|
- !ruby/object:Gem::Version
|
190
|
-
version: '
|
126
|
+
version: '2.3'
|
191
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
128
|
requirements:
|
193
129
|
- - ">="
|
194
130
|
- !ruby/object:Gem::Version
|
195
131
|
version: '0'
|
196
132
|
requirements: []
|
197
|
-
|
198
|
-
rubygems_version: 2.2.2
|
133
|
+
rubygems_version: 3.1.4
|
199
134
|
signing_key:
|
200
135
|
specification_version: 4
|
201
136
|
summary: Full capability support for the Salesforce Bulk API.
|
202
|
-
test_files:
|
203
|
-
- test/fixtures/batch_create_request.csv
|
204
|
-
- test/fixtures/batch_create_response.xml
|
205
|
-
- test/fixtures/batch_info_list_response.xml
|
206
|
-
- test/fixtures/batch_info_response.xml
|
207
|
-
- test/fixtures/batch_result_list_response.csv
|
208
|
-
- test/fixtures/config.yml
|
209
|
-
- test/fixtures/invalid_batch_error.xml
|
210
|
-
- test/fixtures/invalid_error.xml
|
211
|
-
- test/fixtures/invalid_job_error.xml
|
212
|
-
- test/fixtures/invalid_session_error.xml
|
213
|
-
- test/fixtures/job_abort_request.xml
|
214
|
-
- test/fixtures/job_abort_response.xml
|
215
|
-
- test/fixtures/job_close_request.xml
|
216
|
-
- test/fixtures/job_close_response.xml
|
217
|
-
- test/fixtures/job_create_request.xml
|
218
|
-
- test/fixtures/job_create_response.xml
|
219
|
-
- test/fixtures/job_info_response.xml
|
220
|
-
- test/fixtures/login_error.xml
|
221
|
-
- test/fixtures/login_request.xml
|
222
|
-
- test/fixtures/login_response.xml
|
223
|
-
- test/fixtures/query_result_list_response.xml
|
224
|
-
- test/fixtures/query_result_response.csv
|
225
|
-
- test/lib/test_batch.rb
|
226
|
-
- test/lib/test_batch_result.rb
|
227
|
-
- test/lib/test_core_extensions.rb
|
228
|
-
- test/lib/test_initialization.rb
|
229
|
-
- test/lib/test_job.rb
|
230
|
-
- test/lib/test_query_result_collection.rb
|
231
|
-
- test/test_helper.rb
|
137
|
+
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 Javier Julio
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
3
|
-
|
4
|
-
require 'rake/testtask'
|
5
|
-
Rake::TestTask.new(:test) do |test|
|
6
|
-
test.libs << 'lib' << 'test'
|
7
|
-
test.pattern = 'test/**/test_*.rb'
|
8
|
-
test.verbose = true
|
9
|
-
end
|
10
|
-
|
11
|
-
task :default => :test
|
12
|
-
|
13
|
-
namespace :doc do
|
14
|
-
require 'rdoc/task'
|
15
|
-
require File.expand_path('../lib/salesforce_bulk/version', __FILE__)
|
16
|
-
RDoc::Task.new do |rdoc|
|
17
|
-
rdoc.rdoc_dir = 'rdoc'
|
18
|
-
rdoc.title = "SalesforceBulk #{SalesforceBulk::VERSION}"
|
19
|
-
rdoc.main = 'README.md'
|
20
|
-
rdoc.rdoc_files.include('README.md', 'LICENSE.md', 'lib/**/*.rb')
|
21
|
-
end
|
22
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class String
|
2
|
-
# For converting "true" and "false" string values returned
|
3
|
-
# by Salesforce Bulk API in batch results to real booleans.
|
4
|
-
def to_b
|
5
|
-
if present?
|
6
|
-
if lstrip.rstrip.casecmp("true") == 0
|
7
|
-
return true
|
8
|
-
elsif lstrip.rstrip.casecmp("false") == 0
|
9
|
-
return false
|
10
|
-
end
|
11
|
-
end
|
12
|
-
self
|
13
|
-
end
|
14
|
-
end
|
data/salesforcebulk.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "salesforce_bulk/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.platform = Gem::Platform::RUBY
|
7
|
-
s.name = 'salesforcebulk'
|
8
|
-
s.version = SalesforceBulk::VERSION
|
9
|
-
s.summary = %q{Full capability support for the Salesforce Bulk API.}
|
10
|
-
s.description = %q{This gem is a simple interface to the Salesforce Bulk API providing full support for insert, update, upsert, delete, and query actions while allowing you to specify multiple batches per job to process data fast. Gem includes unit tests.}
|
11
|
-
|
12
|
-
s.author = 'Javier Julio'
|
13
|
-
s.email = 'jjfutbol@gmail.com'
|
14
|
-
s.homepage = 'https://github.com/javierjulio/salesforce_bulk'
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split("\n")
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
s.add_dependency "activesupport", '~> 3.2.0'
|
22
|
-
s.add_dependency "xml-simple"
|
23
|
-
|
24
|
-
s.add_development_dependency "rake"
|
25
|
-
s.add_development_dependency "rdoc"
|
26
|
-
s.add_development_dependency "mocha", '~> 0.13.0'
|
27
|
-
s.add_development_dependency "shoulda", '~> 3.3.0'
|
28
|
-
s.add_development_dependency "webmock", '~> 1.8.11'
|
29
|
-
s.add_development_dependency 'minitest', '~> 4.3'
|
30
|
-
end
|