restforce 7.2.0 → 7.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -3
- data/README.md +15 -4
- data/lib/restforce/concerns/composite_api.rb +8 -0
- data/lib/restforce/middleware/gzip.rb +1 -0
- data/lib/restforce/patches/parts.rb +2 -0
- data/lib/restforce/version.rb +1 -1
- data/spec/unit/concerns/composite_api_spec.rb +17 -0
- data/spec/unit/config_spec.rb +27 -0
- data/spec/unit/middleware/gzip_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f34ecbdf8bef8fa7068bef79572000b9766bd9c3be35f8aebe87f43630180910
|
4
|
+
data.tar.gz: 8644247ec7b8201da773efef8d87084b2e91f864fe307eb7d9d0de681c4acc21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df91e270270256472f9a56a384ddf3884d18cdc227910a08132ed6bed8e26063460a7702a0211ea04e93392ffeffaf655211083edfb9013839e63f9ab1eacaf3
|
7
|
+
data.tar.gz: d348b9e29964e071883c40158da5f97a10766b05dc093309f71338ec72f01def17238fc9a65ad3014088cf45a5d7f5e72b11a9ec8d9ad0c446947650ce783c62
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 7.3.1 (Mar 30, 2024)
|
2
|
+
|
3
|
+
- Fix `uninitialized constant StringIO` error by explicitly requiring `StringIO` where it's used (@timrogers)
|
4
|
+
|
5
|
+
# 7.3.0 (Feb 14, 2024 🧡)
|
6
|
+
|
7
|
+
- Add support for making `GET` requests using the Composite API (@shravan097)
|
8
|
+
|
1
9
|
# 7.2.0 (Jan 23, 2024)
|
2
10
|
|
3
11
|
- Add support for `faraday` v2.9.x (@timrogers)
|
data/Gemfile
CHANGED
@@ -13,10 +13,10 @@ gem 'guard-rspec'
|
|
13
13
|
gem 'guard-rubocop'
|
14
14
|
gem 'jruby-openssl', platforms: :jruby
|
15
15
|
gem 'rake'
|
16
|
-
gem 'rspec', '~> 3.
|
16
|
+
gem 'rspec', '~> 3.13.0'
|
17
17
|
gem 'rspec-collection_matchers', '~> 1.2.0'
|
18
18
|
gem 'rspec-its', '~> 1.3.0'
|
19
19
|
gem 'rspec_junit_formatter', '~> 0.6.0'
|
20
|
-
gem 'rubocop', '~> 1.
|
20
|
+
gem 'rubocop', '~> 1.62.1'
|
21
21
|
gem 'simplecov', '~> 0.22.0'
|
22
|
-
gem 'webmock', '~> 3.
|
22
|
+
gem 'webmock', '~> 3.23.0'
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ Features include:
|
|
27
27
|
|
28
28
|
Add this line to your application's Gemfile:
|
29
29
|
|
30
|
-
gem 'restforce', '~> 7.
|
30
|
+
gem 'restforce', '~> 7.3.1'
|
31
31
|
|
32
32
|
And then execute:
|
33
33
|
|
@@ -155,7 +155,7 @@ client = Restforce.new
|
|
155
155
|
|
156
156
|
**Note:** Restforce library does not cache JWT Bearer tokens automatically. This means that every instantiation of the Restforce class will be treated as a new login by Salesforce. Remember that Salesforce enforces [rate limits on login requests](https://help.salesforce.com/s/articleView?id=000312767&type=1). If you are building an application that will instantiate the Restforce class more than this specified rate limit, you might want to consider caching the Bearer token either in-memory or in your own storage by leveraging the `authentication_callback` method.
|
157
157
|
|
158
|
-
|
158
|
+
#### Client Credentials
|
159
159
|
|
160
160
|
If you want to authenticate as an application, you can use the [Client Credentials flow](https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_client_credentials_flow.htm&type=5):
|
161
161
|
|
@@ -163,7 +163,7 @@ If you want to authenticate as an application, you can use the [Client Credentia
|
|
163
163
|
client = Restforce.new(client_id: 'client_id',
|
164
164
|
client_secret: 'client_secret',
|
165
165
|
api_version: '55.0',
|
166
|
-
|
166
|
+
host: 'MYDOMAIN.my.salesforce.com')
|
167
167
|
```
|
168
168
|
|
169
169
|
#### Sandbox Organizations
|
@@ -600,7 +600,6 @@ This feature permits the user to send a composite object—that is, a complex
|
|
600
600
|
object with nested children—in a single API call. Up to 25 requests may be
|
601
601
|
included in a single composite.
|
602
602
|
|
603
|
-
Note that `GET` is not yet implemented for this API.
|
604
603
|
|
605
604
|
```ruby
|
606
605
|
# build up an array of requests:
|
@@ -843,6 +842,18 @@ client.create!("CustomField", {
|
|
843
842
|
})
|
844
843
|
```
|
845
844
|
|
845
|
+
## Configuration Precedence
|
846
|
+
|
847
|
+
Here's the order of precedence from highest to lowest:
|
848
|
+
|
849
|
+
Arguments on new: passing configuration options directly as arguments has the highest precedence. These settings will override any other configuration.
|
850
|
+
|
851
|
+
Configuration block: using Restforce.configure to set configuration options is the next in line. They will take precedence over environment variables and defaults but will be overridden by direct arguments on instantiation.
|
852
|
+
|
853
|
+
Environment variables: has the lowest precedence. If you set options using environment variables, they will be overridden by any other configuration method.
|
854
|
+
|
855
|
+
Defaults: If none of the above methods are used, Restforce falls back to its default configuration values.
|
856
|
+
|
846
857
|
## Contributing
|
847
858
|
|
848
859
|
We welcome all contributions - they help us make Restforce the best gem possible.
|
@@ -93,6 +93,14 @@ module Restforce
|
|
93
93
|
}
|
94
94
|
end
|
95
95
|
|
96
|
+
def find(sobject, reference_id, id)
|
97
|
+
requests << {
|
98
|
+
method: 'GET',
|
99
|
+
url: composite_api_path("#{sobject}/#{id}"),
|
100
|
+
referenceId: reference_id
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
96
104
|
private
|
97
105
|
|
98
106
|
def composite_api_path(path)
|
data/lib/restforce/version.rb
CHANGED
@@ -82,6 +82,23 @@ describe Restforce::Concerns::CompositeAPI do
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
+
it '#find' do
|
86
|
+
client.
|
87
|
+
should_receive(:api_post).
|
88
|
+
with(endpoint, { compositeRequest: [
|
89
|
+
{
|
90
|
+
method: 'GET',
|
91
|
+
url: "/services/data/v38.0/sobjects/Object/00312345",
|
92
|
+
referenceId: 'find_ref'
|
93
|
+
}
|
94
|
+
], allOrNone: all_or_none, collateSubrequests: false }.to_json).
|
95
|
+
and_return(response)
|
96
|
+
|
97
|
+
client.send(method) do |subrequests|
|
98
|
+
subrequests.find('Object', 'find_ref', '00312345')
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
85
102
|
it 'multiple subrequests' do
|
86
103
|
client.
|
87
104
|
should_receive(:api_post).
|
data/spec/unit/config_spec.rb
CHANGED
@@ -70,6 +70,21 @@ describe Restforce do
|
|
70
70
|
expect(Restforce.configuration.send(attr)).to eq 'foobar'
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
it 'takes precedence over environment variables' do
|
75
|
+
{ 'SALESFORCE_USERNAME' => 'env_foo',
|
76
|
+
'SALESFORCE_CLIENT_ID' => 'env_client id' }.
|
77
|
+
each { |var, value| ENV.stub(:fetch).with(var, anything).and_return(value) }
|
78
|
+
|
79
|
+
{ username: 'config_foo', client_id: nil }.each do |attr, value|
|
80
|
+
Restforce.configure do |config|
|
81
|
+
config.send("#{attr}=", value)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
expect(Restforce.configuration.send(:username)).to eq 'config_foo'
|
86
|
+
expect(Restforce.configuration.send(:client_id)).to eq 'env_client id'
|
87
|
+
end
|
73
88
|
end
|
74
89
|
|
75
90
|
describe '#log?' do
|
@@ -138,5 +153,17 @@ describe Restforce do
|
|
138
153
|
checker.check!
|
139
154
|
end
|
140
155
|
end
|
156
|
+
|
157
|
+
it 'shows the precedence over config' do
|
158
|
+
ENV['SALESFORCE_USERNAME'] = 'env_foo'
|
159
|
+
Restforce.configure do |config|
|
160
|
+
config.username = 'config_foo'
|
161
|
+
end
|
162
|
+
client = Restforce.new(username: 'foo')
|
163
|
+
|
164
|
+
expect(client.options[:username]).to eq 'foo'
|
165
|
+
|
166
|
+
Restforce.instance_variable_set :@configuration, nil
|
167
|
+
end
|
141
168
|
end
|
142
169
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Rogers
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|