restforce 3.0.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +9 -11
- data/.rubocop_todo.yml +128 -81
- data/CHANGELOG.md +25 -0
- data/Gemfile +1 -1
- data/README.md +99 -4
- data/lib/restforce/abstract_client.rb +1 -0
- data/lib/restforce/attachment.rb +1 -0
- data/lib/restforce/concerns/api.rb +10 -7
- data/lib/restforce/concerns/batch_api.rb +87 -0
- data/lib/restforce/concerns/canvas.rb +1 -0
- data/lib/restforce/concerns/picklists.rb +1 -0
- data/lib/restforce/concerns/streaming.rb +58 -1
- data/lib/restforce/config.rb +1 -0
- data/lib/restforce/document.rb +1 -0
- data/lib/restforce/middleware/multipart.rb +1 -0
- data/lib/restforce/middleware/raise_error.rb +24 -8
- data/lib/restforce/signed_request.rb +1 -0
- data/lib/restforce/sobject.rb +1 -0
- data/lib/restforce/tooling/client.rb +3 -3
- data/lib/restforce/version.rb +1 -1
- data/lib/restforce.rb +21 -1
- data/restforce.gemspec +6 -6
- data/spec/integration/abstract_client_spec.rb +42 -1
- data/spec/support/fixture_helpers.rb +2 -2
- data/spec/unit/concerns/api_spec.rb +10 -0
- data/spec/unit/concerns/batch_api_spec.rb +107 -0
- data/spec/unit/concerns/streaming_spec.rb +112 -0
- data/spec/unit/middleware/raise_error_spec.rb +32 -11
- metadata +32 -30
@@ -13,34 +13,46 @@ describe Restforce::Middleware::RaiseError do
|
|
13
13
|
context 'when the status code is 404' do
|
14
14
|
let(:status) { 404 }
|
15
15
|
|
16
|
-
it
|
17
|
-
expect { on_complete }.to raise_error
|
16
|
+
it 'raises Restforce::NotFoundError' do
|
17
|
+
expect { on_complete }.to raise_error Restforce::NotFoundError,
|
18
18
|
'INVALID_FIELD: error_message'
|
19
19
|
end
|
20
|
+
|
21
|
+
it 'raises an error that inherits from Faraday::Error::ResourceNotFound' do
|
22
|
+
expect { on_complete }.to raise_error Faraday::Error::ResourceNotFound
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
context 'when the status code is 300' do
|
23
27
|
let(:status) { 300 }
|
24
28
|
|
25
|
-
it
|
26
|
-
expect { on_complete }.to raise_error
|
29
|
+
it 'raises Restforce::MatchesMultipleError' do
|
30
|
+
expect { on_complete }.to raise_error Restforce::MatchesMultipleError,
|
27
31
|
/300: The external ID provided/
|
28
32
|
end
|
33
|
+
|
34
|
+
it 'raises an error that inherits from Faraday::Error::ClientError' do
|
35
|
+
expect { on_complete }.to raise_error Faraday::Error::ClientError
|
36
|
+
end
|
29
37
|
end
|
30
38
|
|
31
39
|
context 'when the status code is 400' do
|
32
40
|
let(:status) { 400 }
|
33
41
|
|
34
|
-
it "raises an error" do
|
35
|
-
expect { on_complete }.to raise_error
|
42
|
+
it "raises an error derived from the response's errorCode" do
|
43
|
+
expect { on_complete }.to raise_error Restforce::ErrorCode::InvalidField,
|
36
44
|
'INVALID_FIELD: error_message'
|
37
45
|
end
|
46
|
+
|
47
|
+
it 'raises an error that inherits from Faraday::Error::ClientError' do
|
48
|
+
expect { on_complete }.to raise_error Faraday::Error::ClientError
|
49
|
+
end
|
38
50
|
end
|
39
51
|
|
40
52
|
context 'when the status code is 401' do
|
41
53
|
let(:status) { 401 }
|
42
54
|
|
43
|
-
it
|
55
|
+
it 'raises Restforce::UnauthorizedError' do
|
44
56
|
expect { on_complete }.to raise_error Restforce::UnauthorizedError,
|
45
57
|
'INVALID_FIELD: error_message'
|
46
58
|
end
|
@@ -49,17 +61,26 @@ describe Restforce::Middleware::RaiseError do
|
|
49
61
|
context 'when the status code is 413' do
|
50
62
|
let(:status) { 413 }
|
51
63
|
|
52
|
-
it
|
53
|
-
expect { on_complete }.to raise_error
|
64
|
+
it 'raises Restforce::EntityTooLargeError' do
|
65
|
+
expect { on_complete }.to raise_error Restforce::EntityTooLargeError,
|
54
66
|
'413: Request Entity Too Large'
|
55
67
|
end
|
68
|
+
|
69
|
+
it 'raises an error that inherits from Faraday::Error::ClientError' do
|
70
|
+
expect { on_complete }.to raise_error Faraday::Error::ClientError
|
71
|
+
end
|
56
72
|
end
|
57
73
|
|
58
74
|
context 'when status is 400+ and body is a string' do
|
59
75
|
let(:body) { 'An error occured' }
|
60
|
-
let(:status) {
|
76
|
+
let(:status) { 400 }
|
77
|
+
|
78
|
+
it 'raises a generic Restforce::ResponseError' do
|
79
|
+
expect { on_complete }.to raise_error Restforce::ResponseError,
|
80
|
+
"(error code missing): #{body}"
|
81
|
+
end
|
61
82
|
|
62
|
-
it 'raises an error
|
83
|
+
it 'raises an error that inherits from Faraday::Error::ClientError' do
|
63
84
|
expect { on_complete }.to raise_error Faraday::Error::ClientError,
|
64
85
|
"(error code missing): #{body}"
|
65
86
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric J. Holmes
|
8
8
|
- Tim Rogers
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.8.8
|
41
|
-
- - "
|
41
|
+
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '1.0'
|
44
44
|
type: :runtime
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: 0.8.8
|
51
|
-
- - "
|
51
|
+
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '1.0'
|
54
54
|
- !ruby/object:Gem::Dependency
|
@@ -86,89 +86,89 @@ dependencies:
|
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '4.0'
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
|
-
name:
|
89
|
+
name: faye
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
94
|
+
version: '0'
|
95
95
|
type: :development
|
96
96
|
prerelease: false
|
97
97
|
version_requirements: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- - "
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: '0'
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
|
-
name:
|
103
|
+
name: rspec
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
108
|
+
version: 2.14.0
|
109
109
|
type: :development
|
110
110
|
prerelease: false
|
111
111
|
version_requirements: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
115
|
+
version: 2.14.0
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
|
-
name:
|
117
|
+
name: rspec_junit_formatter
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 0.
|
122
|
+
version: 0.3.0
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 0.
|
129
|
+
version: 0.3.0
|
130
130
|
- !ruby/object:Gem::Dependency
|
131
131
|
name: rubocop
|
132
132
|
requirement: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: 0.
|
136
|
+
version: 0.75.0
|
137
137
|
type: :development
|
138
138
|
prerelease: false
|
139
139
|
version_requirements: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: 0.
|
143
|
+
version: 0.75.0
|
144
144
|
- !ruby/object:Gem::Dependency
|
145
|
-
name:
|
145
|
+
name: simplecov
|
146
146
|
requirement: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: 0.
|
150
|
+
version: 0.17.1
|
151
151
|
type: :development
|
152
152
|
prerelease: false
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: 0.
|
157
|
+
version: 0.17.1
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
|
-
name:
|
159
|
+
name: webmock
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
|
-
- - "
|
162
|
+
- - "~>"
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version:
|
164
|
+
version: 3.7.6
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
167
|
version_requirements: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- - "
|
169
|
+
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version:
|
171
|
+
version: 3.7.6
|
172
172
|
description: A lightweight ruby client for the Salesforce REST API.
|
173
173
|
email:
|
174
174
|
- eric@ejholmes.net
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/restforce/concerns/api.rb
|
198
198
|
- lib/restforce/concerns/authentication.rb
|
199
199
|
- lib/restforce/concerns/base.rb
|
200
|
+
- lib/restforce/concerns/batch_api.rb
|
200
201
|
- lib/restforce/concerns/caching.rb
|
201
202
|
- lib/restforce/concerns/canvas.rb
|
202
203
|
- lib/restforce/concerns/connection.rb
|
@@ -281,6 +282,7 @@ files:
|
|
281
282
|
- spec/unit/concerns/api_spec.rb
|
282
283
|
- spec/unit/concerns/authentication_spec.rb
|
283
284
|
- spec/unit/concerns/base_spec.rb
|
285
|
+
- spec/unit/concerns/batch_api_spec.rb
|
284
286
|
- spec/unit/concerns/caching_spec.rb
|
285
287
|
- spec/unit/concerns/canvas_spec.rb
|
286
288
|
- spec/unit/concerns/connection_spec.rb
|
@@ -308,7 +310,7 @@ licenses:
|
|
308
310
|
metadata:
|
309
311
|
source_code_uri: https://github.com/restforce/restforce
|
310
312
|
changelog_uri: https://github.com/restforce/restforce/blob/master/CHANGELOG.md
|
311
|
-
post_install_message:
|
313
|
+
post_install_message:
|
312
314
|
rdoc_options: []
|
313
315
|
require_paths:
|
314
316
|
- lib
|
@@ -323,9 +325,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
323
325
|
- !ruby/object:Gem::Version
|
324
326
|
version: '0'
|
325
327
|
requirements: []
|
326
|
-
|
327
|
-
|
328
|
-
signing_key:
|
328
|
+
rubygems_version: 3.2.22
|
329
|
+
signing_key:
|
329
330
|
specification_version: 4
|
330
331
|
summary: A lightweight ruby client for the Salesforce REST API.
|
331
332
|
test_files:
|
@@ -379,6 +380,7 @@ test_files:
|
|
379
380
|
- spec/unit/concerns/api_spec.rb
|
380
381
|
- spec/unit/concerns/authentication_spec.rb
|
381
382
|
- spec/unit/concerns/base_spec.rb
|
383
|
+
- spec/unit/concerns/batch_api_spec.rb
|
382
384
|
- spec/unit/concerns/caching_spec.rb
|
383
385
|
- spec/unit/concerns/canvas_spec.rb
|
384
386
|
- spec/unit/concerns/connection_spec.rb
|