restforce 4.2.1 → 5.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +14 -9
- data/.github/ISSUE_TEMPLATE/unhandled-salesforce-error.md +17 -0
- data/.github/dependabot.yml +19 -0
- data/.rubocop.yml +5 -4
- data/CHANGELOG.md +96 -0
- data/CONTRIBUTING.md +21 -1
- data/Dockerfile +31 -0
- data/Gemfile +10 -7
- data/README.md +94 -21
- data/UPGRADING.md +38 -0
- data/docker-compose.yml +7 -0
- data/lib/restforce/abstract_client.rb +1 -0
- data/lib/restforce/collection.rb +27 -4
- data/lib/restforce/concerns/api.rb +2 -2
- data/lib/restforce/concerns/base.rb +2 -2
- data/lib/restforce/concerns/caching.rb +7 -0
- data/lib/restforce/concerns/composite_api.rb +104 -0
- data/lib/restforce/concerns/picklists.rb +2 -2
- data/lib/restforce/concerns/streaming.rb +1 -3
- data/lib/restforce/config.rb +4 -1
- data/lib/restforce/error_code.rb +647 -0
- data/lib/restforce/file_part.rb +24 -0
- data/lib/restforce/mash.rb +8 -3
- data/lib/restforce/middleware/caching.rb +1 -1
- data/lib/restforce/middleware/logger.rb +8 -7
- data/lib/restforce/middleware/raise_error.rb +3 -4
- data/lib/restforce/middleware.rb +2 -0
- data/lib/restforce/version.rb +1 -1
- data/lib/restforce.rb +6 -7
- data/restforce.gemspec +11 -20
- data/spec/fixtures/sobject/list_view_results_success_response.json +151 -0
- data/spec/integration/abstract_client_spec.rb +41 -32
- data/spec/integration/data/client_spec.rb +6 -2
- data/spec/spec_helper.rb +24 -1
- data/spec/support/client_integration.rb +7 -7
- data/spec/support/concerns.rb +1 -1
- data/spec/support/fixture_helpers.rb +1 -3
- data/spec/support/middleware.rb +1 -2
- data/spec/unit/collection_spec.rb +38 -2
- data/spec/unit/concerns/api_spec.rb +11 -11
- data/spec/unit/concerns/authentication_spec.rb +6 -6
- data/spec/unit/concerns/caching_spec.rb +26 -0
- data/spec/unit/concerns/composite_api_spec.rb +143 -0
- data/spec/unit/concerns/connection_spec.rb +2 -2
- data/spec/unit/concerns/streaming_spec.rb +4 -4
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/error_code_spec.rb +61 -0
- data/spec/unit/mash_spec.rb +5 -0
- data/spec/unit/middleware/authentication/jwt_bearer_spec.rb +4 -4
- data/spec/unit/middleware/authentication/password_spec.rb +2 -2
- data/spec/unit/middleware/authentication/token_spec.rb +2 -2
- data/spec/unit/middleware/authentication_spec.rb +11 -5
- data/spec/unit/middleware/gzip_spec.rb +2 -2
- data/spec/unit/middleware/raise_error_spec.rb +29 -10
- data/spec/unit/signed_request_spec.rb +1 -1
- metadata +41 -125
- data/lib/restforce/upload_io.rb +0 -9
@@ -14,8 +14,10 @@ describe Restforce::Middleware::RaiseError do
|
|
14
14
|
let(:status) { 404 }
|
15
15
|
|
16
16
|
it 'raises Restforce::NotFoundError' do
|
17
|
-
expect { on_complete }.to raise_error
|
18
|
-
|
17
|
+
expect { on_complete }.to raise_error do |error|
|
18
|
+
expect(error).to be_a Restforce::NotFoundError
|
19
|
+
expect(error.message).to start_with("INVALID_FIELD: error_message")
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
it 'raises an error that inherits from Faraday::ResourceNotFound' do
|
@@ -40,8 +42,10 @@ describe Restforce::Middleware::RaiseError do
|
|
40
42
|
let(:status) { 400 }
|
41
43
|
|
42
44
|
it "raises an error derived from the response's errorCode" do
|
43
|
-
expect { on_complete }.to raise_error
|
44
|
-
|
45
|
+
expect { on_complete }.to raise_error do |error|
|
46
|
+
expect(error).to be_a Restforce::ErrorCode::InvalidField
|
47
|
+
expect(error.message).to start_with("INVALID_FIELD: error_message")
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
it 'raises an error that inherits from Faraday::ClientError' do
|
@@ -53,8 +57,10 @@ describe Restforce::Middleware::RaiseError do
|
|
53
57
|
let(:status) { 401 }
|
54
58
|
|
55
59
|
it 'raises Restforce::UnauthorizedError' do
|
56
|
-
expect { on_complete }.to raise_error
|
57
|
-
|
60
|
+
expect { on_complete }.to raise_error do |error|
|
61
|
+
expect(error).to be_a Restforce::UnauthorizedError
|
62
|
+
expect(error.message).to start_with("INVALID_FIELD: error_message")
|
63
|
+
end
|
58
64
|
end
|
59
65
|
end
|
60
66
|
|
@@ -76,13 +82,26 @@ describe Restforce::Middleware::RaiseError do
|
|
76
82
|
let(:status) { 400 }
|
77
83
|
|
78
84
|
it 'raises a generic Restforce::ResponseError' do
|
79
|
-
expect { on_complete }.to raise_error
|
80
|
-
|
85
|
+
expect { on_complete }.to raise_error do |error|
|
86
|
+
expect(error).to be_a Restforce::ResponseError
|
87
|
+
expect(error.message).to start_with("(error code missing): An error occured")
|
88
|
+
end
|
81
89
|
end
|
82
90
|
|
83
91
|
it 'raises an error that inherits from Faraday::ClientError' do
|
84
|
-
expect { on_complete }.to raise_error
|
85
|
-
|
92
|
+
expect { on_complete }.to raise_error do |error|
|
93
|
+
expect(error).to be_a Faraday::ClientError
|
94
|
+
expect(error.message).to start_with("(error code missing): An error occured")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when error code is not already defined' do
|
100
|
+
let(:body) { { 'errorCode' => 'SOMETHING_UNDEFINED' } }
|
101
|
+
let(:status) { 400 }
|
102
|
+
|
103
|
+
it 'raises a generic Restforce::ResponseError' do
|
104
|
+
expect { on_complete }.to raise_error Restforce::ResponseError
|
86
105
|
end
|
87
106
|
end
|
88
107
|
end
|
metadata
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Eric J. Holmes
|
8
7
|
- Tim Rogers
|
9
|
-
|
8
|
+
- Eric J. Holmes
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
+
- - "<"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.9.0
|
18
21
|
- - ">="
|
19
22
|
- !ruby/object:Gem::Version
|
20
23
|
version: 0.9.0
|
21
|
-
- - "<="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '1.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
+
- - "<"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.9.0
|
28
31
|
- - ">="
|
29
32
|
- !ruby/object:Gem::Version
|
30
33
|
version: 0.9.0
|
31
|
-
- - "<="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.0'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: faraday_middleware
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: 0.8.8
|
41
41
|
- - "<="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '2.0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -50,35 +50,7 @@ dependencies:
|
|
50
50
|
version: 0.8.8
|
51
51
|
- - "<="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: json
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 1.7.5
|
61
|
-
type: :runtime
|
62
|
-
prerelease: false
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 1.7.5
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: jwt
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 1.5.6
|
75
|
-
type: :runtime
|
76
|
-
prerelease: false
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: 1.5.6
|
53
|
+
version: '2.0'
|
82
54
|
- !ruby/object:Gem::Dependency
|
83
55
|
name: hashie
|
84
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,7 +60,7 @@ dependencies:
|
|
88
60
|
version: 1.2.0
|
89
61
|
- - "<"
|
90
62
|
- !ruby/object:Gem::Version
|
91
|
-
version: '
|
63
|
+
version: '6.0'
|
92
64
|
type: :runtime
|
93
65
|
prerelease: false
|
94
66
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -98,111 +70,46 @@ dependencies:
|
|
98
70
|
version: 1.2.0
|
99
71
|
- - "<"
|
100
72
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
73
|
+
version: '6.0'
|
102
74
|
- !ruby/object:Gem::Dependency
|
103
|
-
name:
|
75
|
+
name: jwt
|
104
76
|
requirement: !ruby/object:Gem::Requirement
|
105
77
|
requirements:
|
106
78
|
- - ">="
|
107
79
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
109
|
-
type: :
|
80
|
+
version: 1.5.6
|
81
|
+
type: :runtime
|
110
82
|
prerelease: false
|
111
83
|
version_requirements: !ruby/object:Gem::Requirement
|
112
84
|
requirements:
|
113
85
|
- - ">="
|
114
86
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
116
|
-
|
117
|
-
name: rspec
|
118
|
-
requirement: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - "~>"
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: 2.14.0
|
123
|
-
type: :development
|
124
|
-
prerelease: false
|
125
|
-
version_requirements: !ruby/object:Gem::Requirement
|
126
|
-
requirements:
|
127
|
-
- - "~>"
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: 2.14.0
|
130
|
-
- !ruby/object:Gem::Dependency
|
131
|
-
name: rspec_junit_formatter
|
132
|
-
requirement: !ruby/object:Gem::Requirement
|
133
|
-
requirements:
|
134
|
-
- - "~>"
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: 0.4.1
|
137
|
-
type: :development
|
138
|
-
prerelease: false
|
139
|
-
version_requirements: !ruby/object:Gem::Requirement
|
140
|
-
requirements:
|
141
|
-
- - "~>"
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version: 0.4.1
|
144
|
-
- !ruby/object:Gem::Dependency
|
145
|
-
name: rubocop
|
146
|
-
requirement: !ruby/object:Gem::Requirement
|
147
|
-
requirements:
|
148
|
-
- - "~>"
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
version: 0.77.0
|
151
|
-
type: :development
|
152
|
-
prerelease: false
|
153
|
-
version_requirements: !ruby/object:Gem::Requirement
|
154
|
-
requirements:
|
155
|
-
- - "~>"
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: 0.77.0
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: simplecov
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
requirements:
|
162
|
-
- - "~>"
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
version: 0.17.1
|
165
|
-
type: :development
|
166
|
-
prerelease: false
|
167
|
-
version_requirements: !ruby/object:Gem::Requirement
|
168
|
-
requirements:
|
169
|
-
- - "~>"
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
version: 0.17.1
|
172
|
-
- !ruby/object:Gem::Dependency
|
173
|
-
name: webmock
|
174
|
-
requirement: !ruby/object:Gem::Requirement
|
175
|
-
requirements:
|
176
|
-
- - "~>"
|
177
|
-
- !ruby/object:Gem::Version
|
178
|
-
version: 3.7.6
|
179
|
-
type: :development
|
180
|
-
prerelease: false
|
181
|
-
version_requirements: !ruby/object:Gem::Requirement
|
182
|
-
requirements:
|
183
|
-
- - "~>"
|
184
|
-
- !ruby/object:Gem::Version
|
185
|
-
version: 3.7.6
|
186
|
-
description: A lightweight ruby client for the Salesforce REST API.
|
87
|
+
version: 1.5.6
|
88
|
+
description: A lightweight Ruby client for the Salesforce REST API
|
187
89
|
email:
|
90
|
+
- me@timrogers.co.uk
|
188
91
|
- eric@ejholmes.net
|
189
|
-
- tim@gocardless.com
|
190
92
|
executables: []
|
191
93
|
extensions: []
|
192
94
|
extra_rdoc_files: []
|
193
95
|
files:
|
194
96
|
- ".circleci/config.yml"
|
97
|
+
- ".github/ISSUE_TEMPLATE/unhandled-salesforce-error.md"
|
98
|
+
- ".github/dependabot.yml"
|
195
99
|
- ".gitignore"
|
196
100
|
- ".rubocop.yml"
|
197
101
|
- ".rubocop_todo.yml"
|
198
102
|
- CHANGELOG.md
|
199
103
|
- CODE_OF_CONDUCT.md
|
200
104
|
- CONTRIBUTING.md
|
105
|
+
- Dockerfile
|
201
106
|
- Gemfile
|
202
107
|
- Guardfile
|
203
108
|
- LICENSE
|
204
109
|
- README.md
|
205
110
|
- Rakefile
|
111
|
+
- UPGRADING.md
|
112
|
+
- docker-compose.yml
|
206
113
|
- lib/restforce.rb
|
207
114
|
- lib/restforce/abstract_client.rb
|
208
115
|
- lib/restforce/attachment.rb
|
@@ -214,6 +121,7 @@ files:
|
|
214
121
|
- lib/restforce/concerns/batch_api.rb
|
215
122
|
- lib/restforce/concerns/caching.rb
|
216
123
|
- lib/restforce/concerns/canvas.rb
|
124
|
+
- lib/restforce/concerns/composite_api.rb
|
217
125
|
- lib/restforce/concerns/connection.rb
|
218
126
|
- lib/restforce/concerns/picklists.rb
|
219
127
|
- lib/restforce/concerns/streaming.rb
|
@@ -221,6 +129,8 @@ files:
|
|
221
129
|
- lib/restforce/config.rb
|
222
130
|
- lib/restforce/data/client.rb
|
223
131
|
- lib/restforce/document.rb
|
132
|
+
- lib/restforce/error_code.rb
|
133
|
+
- lib/restforce/file_part.rb
|
224
134
|
- lib/restforce/mash.rb
|
225
135
|
- lib/restforce/middleware.rb
|
226
136
|
- lib/restforce/middleware/authentication.rb
|
@@ -240,7 +150,6 @@ files:
|
|
240
150
|
- lib/restforce/signed_request.rb
|
241
151
|
- lib/restforce/sobject.rb
|
242
152
|
- lib/restforce/tooling/client.rb
|
243
|
-
- lib/restforce/upload_io.rb
|
244
153
|
- lib/restforce/version.rb
|
245
154
|
- restforce.gemspec
|
246
155
|
- script/bootstrap
|
@@ -261,6 +170,7 @@ files:
|
|
261
170
|
- spec/fixtures/sobject/get_deleted_success_response.json
|
262
171
|
- spec/fixtures/sobject/get_updated_success_response.json
|
263
172
|
- spec/fixtures/sobject/list_sobjects_success_response.json
|
173
|
+
- spec/fixtures/sobject/list_view_results_success_response.json
|
264
174
|
- spec/fixtures/sobject/org_query_response.json
|
265
175
|
- spec/fixtures/sobject/query_aggregate_success_response.json
|
266
176
|
- spec/fixtures/sobject/query_empty_response.json
|
@@ -301,11 +211,13 @@ files:
|
|
301
211
|
- spec/unit/concerns/batch_api_spec.rb
|
302
212
|
- spec/unit/concerns/caching_spec.rb
|
303
213
|
- spec/unit/concerns/canvas_spec.rb
|
214
|
+
- spec/unit/concerns/composite_api_spec.rb
|
304
215
|
- spec/unit/concerns/connection_spec.rb
|
305
216
|
- spec/unit/concerns/streaming_spec.rb
|
306
217
|
- spec/unit/config_spec.rb
|
307
218
|
- spec/unit/data/client_spec.rb
|
308
219
|
- spec/unit/document_spec.rb
|
220
|
+
- spec/unit/error_code_spec.rb
|
309
221
|
- spec/unit/mash_spec.rb
|
310
222
|
- spec/unit/middleware/authentication/jwt_bearer_spec.rb
|
311
223
|
- spec/unit/middleware/authentication/password_spec.rb
|
@@ -321,13 +233,14 @@ files:
|
|
321
233
|
- spec/unit/signed_request_spec.rb
|
322
234
|
- spec/unit/sobject_spec.rb
|
323
235
|
- spec/unit/tooling/client_spec.rb
|
324
|
-
homepage:
|
236
|
+
homepage: https://restforce.github.io/
|
325
237
|
licenses:
|
326
238
|
- MIT
|
327
239
|
metadata:
|
328
240
|
source_code_uri: https://github.com/restforce/restforce
|
329
241
|
changelog_uri: https://github.com/restforce/restforce/blob/master/CHANGELOG.md
|
330
|
-
|
242
|
+
rubygems_mfa_required: 'true'
|
243
|
+
post_install_message:
|
331
244
|
rdoc_options: []
|
332
245
|
require_paths:
|
333
246
|
- lib
|
@@ -335,17 +248,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
335
248
|
requirements:
|
336
249
|
- - ">="
|
337
250
|
- !ruby/object:Gem::Version
|
338
|
-
version: '2.
|
251
|
+
version: '2.6'
|
339
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
340
253
|
requirements:
|
341
254
|
- - ">="
|
342
255
|
- !ruby/object:Gem::Version
|
343
256
|
version: '0'
|
344
257
|
requirements: []
|
345
|
-
rubygems_version: 3.
|
346
|
-
signing_key:
|
258
|
+
rubygems_version: 3.3.3
|
259
|
+
signing_key:
|
347
260
|
specification_version: 4
|
348
|
-
summary: A lightweight
|
261
|
+
summary: A lightweight Ruby client for the Salesforce REST API
|
349
262
|
test_files:
|
350
263
|
- spec/fixtures/auth_error_response.json
|
351
264
|
- spec/fixtures/auth_success_response.json
|
@@ -361,6 +274,7 @@ test_files:
|
|
361
274
|
- spec/fixtures/sobject/get_deleted_success_response.json
|
362
275
|
- spec/fixtures/sobject/get_updated_success_response.json
|
363
276
|
- spec/fixtures/sobject/list_sobjects_success_response.json
|
277
|
+
- spec/fixtures/sobject/list_view_results_success_response.json
|
364
278
|
- spec/fixtures/sobject/org_query_response.json
|
365
279
|
- spec/fixtures/sobject/query_aggregate_success_response.json
|
366
280
|
- spec/fixtures/sobject/query_empty_response.json
|
@@ -401,11 +315,13 @@ test_files:
|
|
401
315
|
- spec/unit/concerns/batch_api_spec.rb
|
402
316
|
- spec/unit/concerns/caching_spec.rb
|
403
317
|
- spec/unit/concerns/canvas_spec.rb
|
318
|
+
- spec/unit/concerns/composite_api_spec.rb
|
404
319
|
- spec/unit/concerns/connection_spec.rb
|
405
320
|
- spec/unit/concerns/streaming_spec.rb
|
406
321
|
- spec/unit/config_spec.rb
|
407
322
|
- spec/unit/data/client_spec.rb
|
408
323
|
- spec/unit/document_spec.rb
|
324
|
+
- spec/unit/error_code_spec.rb
|
409
325
|
- spec/unit/mash_spec.rb
|
410
326
|
- spec/unit/middleware/authentication/jwt_bearer_spec.rb
|
411
327
|
- spec/unit/middleware/authentication/password_spec.rb
|