salesforce_bulk_api_serial_or_parallel 0.4 → 0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14dee5e62d34fcfd8ac5a6f8e2525b67a95a4528
4
- data.tar.gz: 163d39b7f6a9ee69a50942fa9a80d24e1af42207
3
+ metadata.gz: c7ac3272005c751ac0d3ab8d94b890642096d9a2
4
+ data.tar.gz: 37fa7e3d082a46c0bb65f0f180650cf38bc4336c
5
5
  SHA512:
6
- metadata.gz: 1c5ef0eaabc85bfe408b78f9ebcf92cb7a9b934707c5ad659773179141719fcc832cb88a9ec05dbd87efd0ef3ad3c71839fdc12f0c3d336471e9f1d946df808b
7
- data.tar.gz: 820ad282fe17dee0a3048c5f6446df97339184df0b8dc0bb57046e9747747eed1dcca29fd9920bb6ba688d02d1148f27cb9891f84eb492a7b536297b3992f235
6
+ metadata.gz: 437e2dbdc119939d82cc4b51236d250030a9c889d566efba9be8b9d2e428390c967fe153f10978c00c951a94490e9ed283bcc77bef973f39af1061d1fbc179d7
7
+ data.tar.gz: 786998f7b590ad124b77fb274b2a0745724c3d4957092904c748530226f6ceb13ef2e6945cc0844fa3fb195d4563e9a96095f17fac496a1912f64032e8edb00a
data/.gitignore CHANGED
@@ -6,4 +6,3 @@ Gemfile.lock
6
6
  pkg/*
7
7
  auth_credentials.yml
8
8
  *.swp
9
- .idea
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /></RakeGroup></Settings>
data/.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.1.9" project-jdk-type="RUBY_SDK" />
7
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/salesforce_bulk_api.iml" filepath="$PROJECT_DIR$/.idea/salesforce_bulk_api.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$" />
8
+ <orderEntry type="inheritedJdk" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.14.6, RVM: ruby-2.1.9) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.1.9) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="faraday (v0.9.2, RVM: ruby-2.1.9) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="json (v1.8.6, RVM: ruby-2.1.9) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="multipart-post (v2.0.0, RVM: ruby-2.1.9) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="pry (v0.10.4, RVM: ruby-2.1.9) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.4.0, RVM: ruby-2.1.9) [gem]" level="application" />
17
+ </component>
18
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,324 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="d2e86cd3-742e-4101-9fd6-ad4ecdcca979" name="Default" comment="" />
5
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
6
+ <option name="TRACKING_ENABLED" value="true" />
7
+ <option name="SHOW_DIALOG" value="false" />
8
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
9
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
10
+ <option name="LAST_RESOLUTION" value="IGNORE" />
11
+ </component>
12
+ <component name="FileEditorManager">
13
+ <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
14
+ <file leaf-file-name="salesforce_bulk_api_serial_or_parallel.rb" pinned="false" current-in-tab="false">
15
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel.rb">
16
+ <provider selected="true" editor-type-id="text-editor">
17
+ <state relative-caret-position="527">
18
+ <caret line="31" column="103" selection-start-line="31" selection-start-column="103" selection-end-line="31" selection-end-column="103" />
19
+ </state>
20
+ </provider>
21
+ </entry>
22
+ </file>
23
+ <file leaf-file-name="version.rb" pinned="false" current-in-tab="true">
24
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/version.rb">
25
+ <provider selected="true" editor-type-id="text-editor">
26
+ <state relative-caret-position="17">
27
+ <caret line="1" column="16" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
28
+ </state>
29
+ </provider>
30
+ </entry>
31
+ </file>
32
+ </leaf>
33
+ </component>
34
+ <component name="FindInProjectRecents">
35
+ <findStrings>
36
+ <find>do_operation</find>
37
+ <find>SalesforceBulkApi</find>
38
+ <find>salesforce_bulk_api</find>
39
+ <find>Serial</find>
40
+ <find>SalesforceBulkApiSerialOrParallel</find>
41
+ <find>1.0.1</find>
42
+ <find>version</find>
43
+ </findStrings>
44
+ </component>
45
+ <component name="Git.Settings">
46
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
47
+ </component>
48
+ <component name="IdeDocumentHistory">
49
+ <option name="CHANGED_PATHS">
50
+ <list>
51
+ <option value="$PROJECT_DIR$/lib/salesforce_bulk_api/job.rb" />
52
+ <option value="$PROJECT_DIR$/lib/salesforce_bulk_api.rb" />
53
+ <option value="$PROJECT_DIR$/salesforce_bulk_api.gemspec" />
54
+ <option value="$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/job.rb" />
55
+ <option value="$PROJECT_DIR$/README.md" />
56
+ <option value="$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel.rb" />
57
+ <option value="$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/version.rb" />
58
+ </list>
59
+ </option>
60
+ </component>
61
+ <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
62
+ <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
63
+ <component name="JsGulpfileManager">
64
+ <detection-done>true</detection-done>
65
+ <sorting>DEFINITION_ORDER</sorting>
66
+ </component>
67
+ <component name="NodePackageJsonFileManager">
68
+ <packageJsonPaths />
69
+ </component>
70
+ <component name="ProjectFrameBounds">
71
+ <option name="y" value="23" />
72
+ <option name="width" value="1440" />
73
+ <option name="height" value="807" />
74
+ </component>
75
+ <component name="ProjectView">
76
+ <navigator proportions="" version="1">
77
+ <foldersAlwaysOnTop value="true" />
78
+ </navigator>
79
+ <panes>
80
+ <pane id="ProjectPane">
81
+ <subPane>
82
+ <expand>
83
+ <path>
84
+ <item name="salesforce_bulk_api" type="b2602c69:ProjectViewProjectNode" />
85
+ <item name="salesforce_bulk_api" type="462c0819:PsiDirectoryNode" />
86
+ </path>
87
+ <path>
88
+ <item name="salesforce_bulk_api" type="b2602c69:ProjectViewProjectNode" />
89
+ <item name="salesforce_bulk_api" type="462c0819:PsiDirectoryNode" />
90
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
91
+ </path>
92
+ <path>
93
+ <item name="salesforce_bulk_api" type="b2602c69:ProjectViewProjectNode" />
94
+ <item name="salesforce_bulk_api" type="462c0819:PsiDirectoryNode" />
95
+ <item name="spec" type="462c0819:PsiDirectoryNode" />
96
+ </path>
97
+ <path>
98
+ <item name="salesforce_bulk_api" type="b2602c69:ProjectViewProjectNode" />
99
+ <item name="salesforce_bulk_api" type="462c0819:PsiDirectoryNode" />
100
+ <item name="spec" type="462c0819:PsiDirectoryNode" />
101
+ <item name="salesforce_bulk_api_serial_or_parallel" type="462c0819:PsiDirectoryNode" />
102
+ </path>
103
+ </expand>
104
+ <select />
105
+ </subPane>
106
+ </pane>
107
+ <pane id="Scope" />
108
+ </panes>
109
+ </component>
110
+ <component name="PropertiesComponent">
111
+ <property name="WebServerToolWindowFactoryState" value="false" />
112
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
113
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
114
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
115
+ </component>
116
+ <component name="RunDashboard">
117
+ <option name="ruleStates">
118
+ <list>
119
+ <RuleState>
120
+ <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
121
+ </RuleState>
122
+ <RuleState>
123
+ <option name="name" value="StatusDashboardGroupingRule" />
124
+ </RuleState>
125
+ </list>
126
+ </option>
127
+ </component>
128
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
129
+ <component name="SvnConfiguration">
130
+ <configuration />
131
+ </component>
132
+ <component name="TaskManager">
133
+ <task active="true" id="Default" summary="Default task">
134
+ <changelist id="d2e86cd3-742e-4101-9fd6-ad4ecdcca979" name="Default" comment="" />
135
+ <created>1525529428252</created>
136
+ <option name="number" value="Default" />
137
+ <option name="presentableId" value="Default" />
138
+ <updated>1525529428252</updated>
139
+ <workItem from="1525529429653" duration="2329000" />
140
+ <workItem from="1525784378982" duration="1712000" />
141
+ <workItem from="1525786527346" duration="4277000" />
142
+ <workItem from="1525796743721" duration="279000" />
143
+ <workItem from="1525797160162" duration="20000" />
144
+ </task>
145
+ <servers />
146
+ </component>
147
+ <component name="TimeTrackingManager">
148
+ <option name="totallyTimeSpent" value="8617000" />
149
+ </component>
150
+ <component name="ToolWindowManager">
151
+ <frame x="0" y="23" width="1440" height="807" extended-state="0" />
152
+ <layout>
153
+ <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2639485" />
154
+ <window_info anchor="bottom" id="TODO" order="6" />
155
+ <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
156
+ <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
157
+ <window_info anchor="right" id="Database" order="3" />
158
+ <window_info anchor="bottom" id="Find" order="1" weight="0.32928476" />
159
+ <window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
160
+ <window_info anchor="bottom" id="Version Control" order="7" />
161
+ <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
162
+ <window_info anchor="bottom" id="Terminal" order="7" />
163
+ <window_info id="Favorites" order="2" side_tool="true" />
164
+ <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
165
+ <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
166
+ <window_info anchor="right" id="Commander" order="0" weight="0.4" />
167
+ <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
168
+ <window_info anchor="bottom" id="Run" order="2" />
169
+ <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
170
+ <window_info anchor="bottom" id="Messages" order="7" weight="0.32928476" />
171
+ <window_info anchor="bottom" id="Message" order="0" />
172
+ <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
173
+ </layout>
174
+ </component>
175
+ <component name="TypeScriptGeneratedFilesManager">
176
+ <option name="version" value="1" />
177
+ </component>
178
+ <component name="VcsContentAnnotationSettings">
179
+ <option name="myLimit" value="2678400000" />
180
+ </component>
181
+ <component name="editorHistoryManager">
182
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel.rb">
183
+ <provider selected="true" editor-type-id="text-editor">
184
+ <state relative-caret-position="527">
185
+ <caret line="31" column="103" selection-start-line="31" selection-start-column="103" selection-end-line="31" selection-end-column="103" />
186
+ </state>
187
+ </provider>
188
+ </entry>
189
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/version.rb">
190
+ <provider selected="true" editor-type-id="text-editor">
191
+ <state relative-caret-position="17">
192
+ <caret line="1" column="16" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
193
+ </state>
194
+ </provider>
195
+ </entry>
196
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel.rb">
197
+ <provider selected="true" editor-type-id="text-editor">
198
+ <state relative-caret-position="255">
199
+ <caret line="15" column="32" selection-start-line="15" selection-start-column="32" selection-end-line="15" selection-end-column="32" />
200
+ </state>
201
+ </provider>
202
+ </entry>
203
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/version.rb">
204
+ <provider selected="true" editor-type-id="text-editor">
205
+ <state relative-caret-position="17">
206
+ <caret line="1" column="16" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
207
+ </state>
208
+ </provider>
209
+ </entry>
210
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel.rb">
211
+ <provider selected="true" editor-type-id="text-editor">
212
+ <state relative-caret-position="510">
213
+ <caret line="30" column="107" selection-start-line="30" selection-start-column="107" selection-end-line="30" selection-end-column="107" />
214
+ </state>
215
+ </provider>
216
+ </entry>
217
+ <entry file="file://$PROJECT_DIR$/salesforce_bulk_api_serial_or_parallel.gemspec">
218
+ <provider selected="true" editor-type-id="text-editor">
219
+ <state relative-caret-position="102">
220
+ <caret line="6" column="51" selection-start-line="6" selection-start-column="18" selection-end-line="6" selection-end-column="51" />
221
+ </state>
222
+ </provider>
223
+ </entry>
224
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/version.rb">
225
+ <provider selected="true" editor-type-id="text-editor">
226
+ <state>
227
+ <caret column="40" selection-start-column="7" selection-end-column="40" />
228
+ </state>
229
+ </provider>
230
+ </entry>
231
+ <entry file="file://$PROJECT_DIR$/README.md">
232
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
233
+ <state split_layout="SPLIT">
234
+ <first_editor relative-caret-position="119">
235
+ <caret line="7" lean-forward="true" selection-start-line="7" selection-end-line="7" />
236
+ </first_editor>
237
+ <second_editor />
238
+ </state>
239
+ </provider>
240
+ </entry>
241
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/job.rb">
242
+ <provider selected="true" editor-type-id="text-editor">
243
+ <state>
244
+ <caret column="21" selection-start-column="21" selection-end-column="21" />
245
+ </state>
246
+ </provider>
247
+ </entry>
248
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel.rb">
249
+ <provider selected="true" editor-type-id="text-editor">
250
+ <state relative-caret-position="255">
251
+ <caret line="15" column="35" selection-start-line="15" selection-start-column="35" selection-end-line="15" selection-end-column="35" />
252
+ </state>
253
+ </provider>
254
+ </entry>
255
+ <entry file="file://$PROJECT_DIR$/salesforce_bulk_api_serial_or_parallel.gemspec">
256
+ <provider selected="true" editor-type-id="text-editor">
257
+ <state relative-caret-position="102">
258
+ <caret line="6" column="51" selection-start-line="6" selection-start-column="18" selection-end-line="6" selection-end-column="51" />
259
+ </state>
260
+ </provider>
261
+ </entry>
262
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/job.rb">
263
+ <provider selected="true" editor-type-id="text-editor">
264
+ <state>
265
+ <caret column="21" lean-forward="true" selection-start-column="21" selection-end-column="21" />
266
+ </state>
267
+ </provider>
268
+ </entry>
269
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/version.rb">
270
+ <provider selected="true" editor-type-id="text-editor">
271
+ <state relative-caret-position="17">
272
+ <caret line="1" column="16" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
273
+ </state>
274
+ </provider>
275
+ </entry>
276
+ <entry file="file://$PROJECT_DIR$/salesforce_bulk_api.gemspec" />
277
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/job.rb">
278
+ <provider selected="true" editor-type-id="text-editor">
279
+ <state>
280
+ <caret column="21" selection-start-column="21" selection-end-column="21" />
281
+ </state>
282
+ </provider>
283
+ </entry>
284
+ <entry file="file://$PROJECT_DIR$/salesforce_bulk_api_serial_or_parallel.gemspec">
285
+ <provider selected="true" editor-type-id="text-editor">
286
+ <state relative-caret-position="102">
287
+ <caret line="6" column="51" selection-start-line="6" selection-start-column="18" selection-end-line="6" selection-end-column="51" />
288
+ </state>
289
+ </provider>
290
+ </entry>
291
+ <entry file="file://$PROJECT_DIR$/README.md">
292
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
293
+ <state split_layout="SPLIT">
294
+ <first_editor relative-caret-position="-1230">
295
+ <caret line="7" selection-start-line="7" selection-end-line="7" />
296
+ </first_editor>
297
+ <second_editor />
298
+ </state>
299
+ </provider>
300
+ </entry>
301
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/connection.rb">
302
+ <provider selected="true" editor-type-id="text-editor">
303
+ <state relative-caret-position="51">
304
+ <caret line="3" column="8" selection-start-line="3" selection-start-column="8" selection-end-line="3" selection-end-column="8" />
305
+ </state>
306
+ </provider>
307
+ </entry>
308
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api/connection.rb" />
309
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel.rb">
310
+ <provider selected="true" editor-type-id="text-editor">
311
+ <state relative-caret-position="527">
312
+ <caret line="31" column="103" selection-start-line="31" selection-start-column="103" selection-end-line="31" selection-end-column="103" />
313
+ </state>
314
+ </provider>
315
+ </entry>
316
+ <entry file="file://$PROJECT_DIR$/lib/salesforce_bulk_api_serial_or_parallel/version.rb">
317
+ <provider selected="true" editor-type-id="text-editor">
318
+ <state relative-caret-position="17">
319
+ <caret line="1" column="16" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
320
+ </state>
321
+ </provider>
322
+ </entry>
323
+ </component>
324
+ </project>
data/README.md CHANGED
@@ -48,7 +48,7 @@ OR
48
48
  client_secret: SFDC_APP_CONFIG['SFDC_CLIENT_SECRET'].to_i,
49
49
  host: SFDC_APP_CONFIG['SFDC_HOST']
50
50
  )
51
- client.authenticate!
51
+
52
52
  salesforce = SalesforceBulkApi::Api.new(client)
53
53
 
54
54
 
@@ -1,10 +1,11 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
+ Bundler.require()
4
+ require 'salesforce_bulk_api/version'
3
5
  require 'net/https'
4
6
  require 'xmlsimple'
5
7
  require 'csv'
6
8
 
7
- require 'salesforce_bulk_api_serial_or_parallel/version'
8
9
  require 'salesforce_bulk_api_serial_or_parallel/concerns/throttling'
9
10
  require 'salesforce_bulk_api_serial_or_parallel/job'
10
11
  require 'salesforce_bulk_api_serial_or_parallel/connection'
@@ -13,10 +14,10 @@ module SalesforceBulkApiSerialOrParallel
13
14
  class Api
14
15
  attr_reader :connection
15
16
 
16
- SALESFORCE_API_VERSION = '42.0'
17
+ @@SALESFORCE_API_VERSION = '32.0'
17
18
 
18
19
  def initialize(client)
19
- @connection = SalesforceBulkApiSerialOrParallel::Connection.new(SALESFORCE_API_VERSION, client)
20
+ @connection = SalesforceBulkApiSerialOrParallel::Connection.new(@@SALESFORCE_API_VERSION, client)
20
21
  @listeners = { job_created: [] }
21
22
  end
22
23
 
@@ -11,7 +11,7 @@ module SalesforceBulkApiSerialOrParallel::Concerns
11
11
  end
12
12
 
13
13
  def set_status_throttle(limit_seconds)
14
- set_throttle_limit_in_seconds(limit_seconds, [:http_method, :path], ->(details) { details[:http_method] == :get })
14
+ set_throttle_limit_in_seconds(limit_seconds, [:http_method, :path], ->(details) { details[:path] == :get })
15
15
  end
16
16
 
17
17
  def set_throttle_limit_in_seconds(limit_seconds, throttle_by_keys, only_if)
@@ -4,12 +4,19 @@ require 'timeout'
4
4
  class Connection
5
5
  include Concerns::Throttling
6
6
 
7
- LOGIN_HOST = 'login.salesforce.com'
8
-
9
- def initialize(api_version, client)
10
- @client = client
11
- @api_version = api_version
12
- @path_prefix = "/services/async/#{@api_version}/"
7
+ @@XML_HEADER = '<?xml version="1.0" encoding="utf-8" ?>'
8
+ @@API_VERSION = nil
9
+ @@LOGIN_HOST = 'login.salesforce.com'
10
+ @@INSTANCE_HOST = nil # Gets set in login()
11
+
12
+ def initialize(api_version,client)
13
+ @client=client
14
+ @session_id = nil
15
+ @server_url = nil
16
+ @instance = nil
17
+ @@API_VERSION = api_version
18
+ @@LOGIN_PATH = "/services/Soap/u/#{@@API_VERSION}"
19
+ @@PATH_PREFIX = "/services/async/#{@@API_VERSION}/"
13
20
 
14
21
  login()
15
22
  end
@@ -18,21 +25,21 @@ require 'timeout'
18
25
  client_type = @client.class.to_s
19
26
  case client_type
20
27
  when "Restforce::Data::Client"
21
- @session_id = @client.options[:oauth_token]
22
- @server_url = @client.options[:instance_url]
28
+ @session_id=@client.options[:oauth_token]
29
+ @server_url=@client.options[:instance_url]
23
30
  else
24
- @session_id = @client.oauth_token
25
- @server_url = @client.instance_url
31
+ @session_id=@client.oauth_token
32
+ @server_url=@client.instance_url
26
33
  end
27
34
  @instance = parse_instance()
28
- @instance_host = "#{@instance}.salesforce.com"
35
+ @@INSTANCE_HOST = "#{@instance}.salesforce.com"
29
36
  end
30
37
 
31
38
  def post_xml(host, path, xml, headers)
32
- host = host || @instance_host
33
- if host != LOGIN_HOST # Not login, need to add session id to header
39
+ host = host || @@INSTANCE_HOST
40
+ if host != @@LOGIN_HOST # Not login, need to add session id to header
34
41
  headers['X-SFDC-Session'] = @session_id
35
- path = "#{@path_prefix}#{path}"
42
+ path = "#{@@PATH_PREFIX}#{path}"
36
43
  end
37
44
  i = 0
38
45
  begin
@@ -52,9 +59,9 @@ require 'timeout'
52
59
  end
53
60
 
54
61
  def get_request(host, path, headers)
55
- host = host || @instance_host
56
- path = "#{@path_prefix}#{path}"
57
- if host != LOGIN_HOST # Not login, need to add session id to header
62
+ host = host || @@INSTANCE_HOST
63
+ path = "#{@@PATH_PREFIX}#{path}"
64
+ if host != @@LOGIN_HOST # Not login, need to add session id to header
58
65
  headers['X-SFDC-Session'] = @session_id;
59
66
  end
60
67
 
@@ -45,6 +45,7 @@ module SalesforceBulkApiSerialOrParallel
45
45
  raise SalesforceException.new("#{response_parsed['exceptionMessage'][0]} (#{response_parsed['exceptionCode'][0]})") if response_parsed['exceptionCode']
46
46
 
47
47
  @job_id = response_parsed['id'][0]
48
+
48
49
  end
49
50
 
50
51
  def close_job()
@@ -76,7 +77,7 @@ module SalesforceBulkApiSerialOrParallel
76
77
  @records_dup = @records.clone
77
78
 
78
79
  super_records = []
79
- (@records_dup.size / @batch_size).to_i.times do
80
+ (@records_dup.size/@batch_size).to_i.times do
80
81
  super_records << @records_dup.pop(@batch_size)
81
82
  end
82
83
  super_records << @records_dup unless @records_dup.empty?
@@ -173,18 +174,11 @@ module SalesforceBulkApiSerialOrParallel
173
174
  state = []
174
175
  Timeout::timeout(timeout, SalesforceBulkApiSerialOrParallel::JobTimeout) do
175
176
  while true
176
- job_status = self.check_job_status
177
- if job_status && job_status['state'] && job_status['state'][0] == 'Closed'
178
- batch_statuses = {}
179
-
180
- batches_ready = @batch_ids.all? do |batch_id|
181
- batch_state = batch_statuses[batch_id] = self.check_batch_status(batch_id)
182
- batch_state && batch_state['state'] && batch_state['state'][0] && !['Queued', 'InProgress'].include?(batch_state['state'][0])
183
- end
184
-
185
- if batches_ready
186
- @batch_ids.each do |batch_id|
187
- state.insert(0, batch_statuses[batch_id])
177
+ if self.check_job_status['state'][0] == 'Closed'
178
+ @batch_ids.each do |batch_id|
179
+ batch_state = self.check_batch_status(batch_id)
180
+ if batch_state['state'][0] != "Queued" && batch_state['state'][0] != "InProgress"
181
+ state << (batch_state)
188
182
  @batch_ids.delete(batch_id)
189
183
  end
190
184
  end
@@ -1,3 +1,3 @@
1
1
  module SalesforceBulkApiSerialOrParallel
2
- VERSION = '0.4'
2
+ VERSION = '0.5'
3
3
  end
@@ -111,18 +111,18 @@ describe SalesforceBulkApiSerialOrParallel do
111
111
  context 'when passed get_result = true with batches' do
112
112
  it 'returns the results array' do
113
113
  res = @api.update('Account', [{:Id => @account_id, :Website => 'www.test.com'}, {:Id => @account_id, :Website => 'www.test.com'}, {:Id => @account_id, :Website => 'www.test.com'}, {:Id => 'abc123', :Website => 'www.test.com'}], true, false, [], 2)
114
-
115
114
  res['batches'][0]['response'][0]['id'][0].should start_with(@account_id)
116
115
  res['batches'][0]['response'][0]['success'].should eq ['true']
117
116
  res['batches'][0]['response'][0]['created'].should eq ['false']
118
- res['batches'][0]['response'][1]['id'][0].should start_with(@account_id)
119
- res['batches'][0]['response'][1]['success'].should eq ['true']
120
- res['batches'][0]['response'][1]['created'].should eq ['false']
117
+
118
+ res['batches'][0]['response'][1].should eq({"errors"=>[{"fields"=>["Id"], "message"=>["Account ID: id value of incorrect type: abc123"], "statusCode"=>["MALFORMED_ID"]}], "success"=>["false"], "created"=>["false"]})
121
119
 
122
120
  res['batches'][1]['response'][0]['id'][0].should start_with(@account_id)
123
121
  res['batches'][1]['response'][0]['success'].should eq ['true']
124
122
  res['batches'][1]['response'][0]['created'].should eq ['false']
125
- res['batches'][1]['response'][1].should eq({"errors"=>[{"fields"=>["Id"], "message"=>["Account ID: id value of incorrect type: abc123"], "statusCode"=>["MALFORMED_ID"]}], "success"=>["false"], "created"=>["false"]})
123
+ res['batches'][1]['response'][1]['id'][0].should start_with(@account_id)
124
+ res['batches'][1]['response'][1]['success'].should eq ['true']
125
+ res['batches'][1]['response'][1]['created'].should eq ['false']
126
126
  end
127
127
  end
128
128
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce_bulk_api_serial_or_parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendan Keogh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-08 00:00:00.000000000 Z
11
+ date: 2018-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -104,12 +104,17 @@ extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
106
  - ".gitignore"
107
+ - ".idea/.rakeTasks"
108
+ - ".idea/misc.xml"
109
+ - ".idea/modules.xml"
110
+ - ".idea/salesforce_bulk_api.iml"
111
+ - ".idea/vcs.xml"
112
+ - ".idea/workspace.xml"
107
113
  - ".rspec"
108
114
  - Gemfile
109
- - LICENCE
110
115
  - README.md
111
116
  - Rakefile
112
- - auth_credentials.yml.example
117
+ - example_auth_credentials.yml
113
118
  - lib/salesforce_bulk_api_serial_or_parallel.rb
114
119
  - lib/salesforce_bulk_api_serial_or_parallel/concerns/throttling.rb
115
120
  - lib/salesforce_bulk_api_serial_or_parallel/connection.rb
data/LICENCE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Yatish Mehta
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.