restforce 5.2.2 → 5.3.0
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 +4 -4
- data/.github/dependabot.yml +4 -13
- data/.github/workflows/build.yml +26 -0
- data/.github/workflows/faraday.yml +26 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +5 -3
- data/README.md +3 -3
- data/lib/restforce/collection.rb +5 -1
- data/lib/restforce/concerns/base.rb +2 -2
- data/lib/restforce/concerns/composite_api.rb +4 -4
- data/lib/restforce/config.rb +10 -8
- data/lib/restforce/file_part.rb +14 -3
- data/lib/restforce/middleware/authentication.rb +1 -0
- data/lib/restforce/version.rb +1 -1
- data/restforce.gemspec +1 -2
- data/spec/fixtures/sobject/list_view_results_success_response.json +151 -0
- data/spec/unit/collection_spec.rb +18 -0
- data/spec/unit/concerns/api_spec.rb +11 -4
- data/spec/unit/concerns/composite_api_spec.rb +2 -2
- data/spec/unit/config_spec.rb +1 -1
- metadata +12 -86
- data/.circleci/config.yml +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54463ffbbbc7f62bb17637d0bd80f9ed54061333fff5a843e40c152613fbf34b
|
4
|
+
data.tar.gz: 22c2bf1bc1c516a1f31262901ef0c50c8a4417b2dc0c3838178649b220b481cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82ecf32cf2ac55f42c20222a9d53d63ff595f96b591d46de3a0160b87d12a6c31a537c99dd6b08992f7ec1f58a21ba100ea14557660e57bd350eab965f5ef768
|
7
|
+
data.tar.gz: d33636c9271830f8acb4da01201c042ee9147e11cf4514ebc5a144311da350f2e3379469531801fe8e276ddfff2145c7f04f19a19cd77e304da56190b97cc270
|
data/.github/dependabot.yml
CHANGED
@@ -4,16 +4,7 @@ updates:
|
|
4
4
|
directory: "/"
|
5
5
|
schedule:
|
6
6
|
interval: daily
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
- 1.10.0
|
12
|
-
- 1.11.0
|
13
|
-
- 1.12.0
|
14
|
-
- 1.12.1
|
15
|
-
- 1.9.0
|
16
|
-
- dependency-name: webmock
|
17
|
-
versions:
|
18
|
-
- 3.12.0
|
19
|
-
- 3.12.1
|
7
|
+
- package-ecosystem: 'github-actions'
|
8
|
+
directory: '/'
|
9
|
+
schedule:
|
10
|
+
interval: 'daily'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: 'Build'
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [main]
|
5
|
+
pull_request:
|
6
|
+
branches: [main]
|
7
|
+
jobs:
|
8
|
+
lint-and-test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby_version: ['2.6', '2.7', '3.0', '3.1', '3.2.0-preview1']
|
13
|
+
steps:
|
14
|
+
- name: Checkout code
|
15
|
+
uses: actions/checkout@v3
|
16
|
+
- name: Setup Ruby ${{ matrix.ruby_version }}
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
bundler-cache: true
|
20
|
+
ruby-version: ${{ matrix.ruby_version }}
|
21
|
+
- name: Install dependencies
|
22
|
+
run: bundle install
|
23
|
+
- name: Lint Ruby files
|
24
|
+
run: bundle exec rubocop
|
25
|
+
- name: Run RSpec tests
|
26
|
+
run: bundle exec rspec
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: 'Test against supported Faraday minor versions'
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [main]
|
5
|
+
pull_request:
|
6
|
+
branches: [main]
|
7
|
+
jobs:
|
8
|
+
lint-and-test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
faraday_version: ['1.8.0', '1.9.0', '1.10.0']
|
13
|
+
env:
|
14
|
+
FARADAY_VERSION: ~> ${{ matrix.faraday_version }}
|
15
|
+
steps:
|
16
|
+
- name: Checkout code
|
17
|
+
uses: actions/checkout@v3
|
18
|
+
- name: Setup Ruby ${{ matrix.ruby_version }}
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
bundler-cache: true
|
22
|
+
ruby-version: 3.1
|
23
|
+
- name: Install dependencies
|
24
|
+
run: bundle install
|
25
|
+
- name: Run RSpec tests
|
26
|
+
run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# 5.3.0 (May 30, 2022)
|
2
|
+
|
3
|
+
* Add support for Faraday v1.9.x and v1.10.0 (@magni-, @timrogers)
|
4
|
+
* Follow redirects during authentication to support Lightning URLs (e.g. `*.lightning.force.com` instead of `*.my.salesforce.com`) (@nhocki)
|
5
|
+
|
6
|
+
# 5.2.4 (Mar 16, 2022)
|
7
|
+
|
8
|
+
* Fix `Restforce::Collection#size` for Salesforce APIs that use the `size` property to return the total number of results, instead of `totalSize` (@kwong-yw)
|
9
|
+
|
10
|
+
# 5.2.3 (Jan 17, 2022)
|
11
|
+
|
12
|
+
* Add official support for Ruby 3.1 (@timrogers)
|
13
|
+
* Fix handling of responses from the Composite API (@robob27)
|
14
|
+
* Fix dependencies to correctly declare that the gem doesn't work with [faraday](https://github.com/lostisland/faraday) `v1.9.0` or later (@timrogers)
|
15
|
+
|
1
16
|
# 5.2.2 (Dec 16, 2021)
|
2
17
|
|
3
18
|
* Handle the `MALFORMED_SEARCH` error returned by Salesforce (@timrogers)
|
data/Gemfile
CHANGED
@@ -3,15 +3,17 @@
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
gemspec
|
5
5
|
|
6
|
+
# Enable us to explicitly pick a Faraday version when running tests
|
7
|
+
gem 'faraday', ENV.fetch('FARADAY_VERSION', '~> 1.8.0')
|
6
8
|
gem 'faye' unless RUBY_PLATFORM == 'java'
|
7
9
|
gem 'guard-rspec'
|
8
10
|
gem 'guard-rubocop'
|
9
11
|
gem 'jruby-openssl', platforms: :jruby
|
10
12
|
gem 'rake'
|
11
|
-
gem 'rspec', '~> 3.
|
13
|
+
gem 'rspec', '~> 3.11.0'
|
12
14
|
gem 'rspec-collection_matchers', '~> 1.2.0'
|
13
15
|
gem 'rspec-its', '~> 1.3.0'
|
14
|
-
gem 'rspec_junit_formatter', '~> 0.
|
15
|
-
gem 'rubocop', '~> 1.
|
16
|
+
gem 'rspec_junit_formatter', '~> 0.5.1'
|
17
|
+
gem 'rubocop', '~> 1.30.0'
|
16
18
|
gem 'simplecov', '~> 0.21.2'
|
17
19
|
gem 'webmock', '~> 3.14.0'
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Restforce
|
2
2
|
|
3
|
-
[](https://circleci.com/gh/restforce/restforce)
|
4
|
-

|
3
|
+
[](https://circleci.com/gh/restforce/restforce)
|
4
|
+

|
5
5
|
|
6
6
|
Restforce is a ruby gem for the [Salesforce REST api](http://www.salesforce.com/us/developer/docs/api_rest/index.htm).
|
7
7
|
|
@@ -27,7 +27,7 @@ Features include:
|
|
27
27
|
|
28
28
|
Add this line to your application's Gemfile:
|
29
29
|
|
30
|
-
gem 'restforce', '~> 5.
|
30
|
+
gem 'restforce', '~> 5.3.0'
|
31
31
|
|
32
32
|
And then execute:
|
33
33
|
|
data/lib/restforce/collection.rb
CHANGED
@@ -30,8 +30,12 @@ module Restforce
|
|
30
30
|
# Return the number of items in the Collection without making any additional
|
31
31
|
# requests and going through all of the pages of results, one by one. Instead,
|
32
32
|
# we can rely on the total count of results which Salesforce returns.
|
33
|
+
#
|
34
|
+
# Most of the Salesforce API returns this in the `totalSize` attribute. For
|
35
|
+
# some reason, the [List View Results](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_listviewresults.htm)
|
36
|
+
# endpoint (and maybe others?!) uses the `size` attribute.
|
33
37
|
def size
|
34
|
-
@raw_page['totalSize']
|
38
|
+
@raw_page['totalSize'] || @raw_page['size']
|
35
39
|
end
|
36
40
|
alias length size
|
37
41
|
|
@@ -61,9 +61,9 @@ module Restforce
|
|
61
61
|
def initialize(opts = {})
|
62
62
|
raise ArgumentError, 'Please specify a hash of options' unless opts.is_a?(Hash)
|
63
63
|
|
64
|
-
@options = Restforce.configuration.options.
|
64
|
+
@options = Restforce.configuration.options.to_h do |option|
|
65
65
|
[option, Restforce.configuration.send(option)]
|
66
|
-
end
|
66
|
+
end
|
67
67
|
|
68
68
|
@options.merge! opts
|
69
69
|
yield builder if block_given?
|
@@ -24,12 +24,12 @@ module Restforce
|
|
24
24
|
}
|
25
25
|
response = api_post('composite', properties.to_json)
|
26
26
|
|
27
|
-
results = response.body['
|
28
|
-
has_errors = results.any? { |result| result['
|
27
|
+
results = response.body['compositeResponse']
|
28
|
+
has_errors = results.any? { |result| result['httpStatusCode'].digits.last == 4 }
|
29
29
|
if all_or_none && has_errors
|
30
|
-
last_error_index = results.rindex { |result| result['
|
30
|
+
last_error_index = results.rindex { |result| result['httpStatusCode'] != 412 }
|
31
31
|
last_error = results[last_error_index]
|
32
|
-
raise CompositeAPIError, last_error['
|
32
|
+
raise CompositeAPIError, last_error['body'][0]['errorCode']
|
33
33
|
end
|
34
34
|
|
35
35
|
results
|
data/lib/restforce/config.rb
CHANGED
@@ -91,29 +91,31 @@ module Restforce
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
option :api_version, default: lambda { ENV
|
94
|
+
option :api_version, default: lambda { ENV.fetch('SALESFORCE_API_VERSION', '26.0') }
|
95
95
|
|
96
96
|
# The username to use during login.
|
97
|
-
option :username, default: lambda { ENV
|
97
|
+
option :username, default: lambda { ENV.fetch('SALESFORCE_USERNAME', nil) }
|
98
98
|
|
99
99
|
# The password to use during login.
|
100
|
-
option :password, default: lambda { ENV
|
100
|
+
option :password, default: lambda { ENV.fetch('SALESFORCE_PASSWORD', nil) }
|
101
101
|
|
102
102
|
# The security token to use during login.
|
103
|
-
option :security_token, default: lambda {
|
103
|
+
option :security_token, default: lambda {
|
104
|
+
ENV.fetch('SALESFORCE_SECURITY_TOKEN', nil)
|
105
|
+
}
|
104
106
|
|
105
107
|
# The OAuth client id
|
106
|
-
option :client_id, default: lambda { ENV
|
108
|
+
option :client_id, default: lambda { ENV.fetch('SALESFORCE_CLIENT_ID', nil) }
|
107
109
|
|
108
110
|
# The OAuth client secret
|
109
|
-
option :client_secret, default: lambda { ENV
|
111
|
+
option :client_secret, default: lambda { ENV.fetch('SALESFORCE_CLIENT_SECRET', nil) }
|
110
112
|
|
111
113
|
# The private key for JWT authentication
|
112
114
|
option :jwt_key
|
113
115
|
|
114
116
|
# Set this to true if you're authenticating with a Sandbox instance.
|
115
117
|
# Defaults to false.
|
116
|
-
option :host, default: lambda { ENV
|
118
|
+
option :host, default: lambda { ENV.fetch('SALESFORCE_HOST', 'login.salesforce.com') }
|
117
119
|
|
118
120
|
option :oauth_token
|
119
121
|
option :refresh_token
|
@@ -139,7 +141,7 @@ module Restforce
|
|
139
141
|
# Faraday adapter to use. Defaults to Faraday.default_adapter.
|
140
142
|
option :adapter, default: lambda { Faraday.default_adapter }
|
141
143
|
|
142
|
-
option :proxy_uri, default: lambda { ENV
|
144
|
+
option :proxy_uri, default: lambda { ENV.fetch('SALESFORCE_PROXY_URI', nil) }
|
143
145
|
|
144
146
|
# A Proc that is called with the response body after a successful authentication.
|
145
147
|
option :authentication_callback
|
data/lib/restforce/file_part.rb
CHANGED
@@ -1,9 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
rescue LoadError
|
3
|
+
case Faraday::VERSION
|
4
|
+
when /\A0\./
|
6
5
|
require 'faraday/upload_io'
|
6
|
+
when /\A1\.[0-8]\./
|
7
|
+
# Faraday 1.x versions before 1.9 - not matched by
|
8
|
+
# the previous clause - use `FilePart` (which must be explicitly
|
9
|
+
# required)
|
10
|
+
require 'faraday/file_part'
|
11
|
+
when /\A1\./
|
12
|
+
# Later 1.x versions from 1.9 onwards automatically include the
|
13
|
+
# `faraday-multipart` gem, which includes `Faraday::FilePart`
|
14
|
+
require 'faraday/multipart'
|
15
|
+
else
|
16
|
+
raise "Unexpected Faraday version #{Faraday::VERSION} - not sure how to set up " \
|
17
|
+
"multipart support"
|
7
18
|
end
|
8
19
|
|
9
20
|
module Restforce
|
@@ -49,6 +49,7 @@ module Restforce
|
|
49
49
|
@connection ||= Faraday.new(faraday_options) do |builder|
|
50
50
|
builder.use Faraday::Request::UrlEncoded
|
51
51
|
builder.use Restforce::Middleware::Mashify, nil, @options
|
52
|
+
builder.use FaradayMiddleware::FollowRedirects
|
52
53
|
builder.response :json
|
53
54
|
|
54
55
|
if Restforce.log?
|
data/lib/restforce/version.rb
CHANGED
data/restforce.gemspec
CHANGED
@@ -12,7 +12,6 @@ Gem::Specification.new do |gem|
|
|
12
12
|
|
13
13
|
gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
14
14
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
15
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
15
|
gem.name = "restforce"
|
17
16
|
gem.require_paths = ["lib"]
|
18
17
|
gem.version = Restforce::VERSION
|
@@ -25,7 +24,7 @@ Gem::Specification.new do |gem|
|
|
25
24
|
|
26
25
|
gem.required_ruby_version = '>= 2.6'
|
27
26
|
|
28
|
-
gem.add_dependency 'faraday', '<=
|
27
|
+
gem.add_dependency 'faraday', '<= 1.10.0', '>= 0.9.0'
|
29
28
|
gem.add_dependency 'faraday_middleware', ['>= 0.8.8', '<= 2.0']
|
30
29
|
gem.add_dependency 'hashie', '>= 1.2.0', '< 6.0'
|
31
30
|
gem.add_dependency 'jwt', ['>= 1.5.6']
|
@@ -0,0 +1,151 @@
|
|
1
|
+
{
|
2
|
+
"columns" : [ {
|
3
|
+
"ascendingLabel" : "Z-A",
|
4
|
+
"descendingLabel" : "A-Z",
|
5
|
+
"fieldNameOrPath" : "Name",
|
6
|
+
"hidden" : false,
|
7
|
+
"label" : "Account Name",
|
8
|
+
"selectListItem" : "Name",
|
9
|
+
"sortDirection" : "ascending",
|
10
|
+
"sortIndex" : 0,
|
11
|
+
"sortable" : true,
|
12
|
+
"type" : "string"
|
13
|
+
}, {
|
14
|
+
"ascendingLabel" : "Z-A",
|
15
|
+
"descendingLabel" : "A-Z",
|
16
|
+
"fieldNameOrPath" : "Site",
|
17
|
+
"hidden" : false,
|
18
|
+
"label" : "Account Site",
|
19
|
+
"selectListItem" : "Site",
|
20
|
+
"sortDirection" : null,
|
21
|
+
"sortIndex" : null,
|
22
|
+
"sortable" : true,
|
23
|
+
"type" : "string"
|
24
|
+
}, {
|
25
|
+
"ascendingLabel" : "Z-A",
|
26
|
+
"descendingLabel" : "A-Z",
|
27
|
+
"fieldNameOrPath" : "BillingState",
|
28
|
+
"hidden" : false,
|
29
|
+
"label" : "Billing State/Province",
|
30
|
+
"selectListItem" : "BillingState",
|
31
|
+
"sortDirection" : null,
|
32
|
+
"sortIndex" : null,
|
33
|
+
"sortable" : true,
|
34
|
+
"type" : "string"
|
35
|
+
}, {
|
36
|
+
"ascendingLabel" : "9-0",
|
37
|
+
"descendingLabel" : "0-9",
|
38
|
+
"fieldNameOrPath" : "Phone",
|
39
|
+
"hidden" : false,
|
40
|
+
"label" : "Phone",
|
41
|
+
"selectListItem" : "Phone",
|
42
|
+
"sortDirection" : null,
|
43
|
+
"sortIndex" : null,
|
44
|
+
"sortable" : true,
|
45
|
+
"type" : "phone"
|
46
|
+
}, {
|
47
|
+
"ascendingLabel" : "Low to High",
|
48
|
+
"descendingLabel" : "High to Low",
|
49
|
+
"fieldNameOrPath" : "Type",
|
50
|
+
"hidden" : false,
|
51
|
+
"label" : "Type",
|
52
|
+
"selectListItem" : "toLabel(Type)",
|
53
|
+
"sortDirection" : null,
|
54
|
+
"sortIndex" : null,
|
55
|
+
"sortable" : true,
|
56
|
+
"type" : "picklist"
|
57
|
+
}, {
|
58
|
+
"ascendingLabel" : "Z-A",
|
59
|
+
"descendingLabel" : "A-Z",
|
60
|
+
"fieldNameOrPath" : "Owner.Alias",
|
61
|
+
"hidden" : false,
|
62
|
+
"label" : "Account Owner Alias",
|
63
|
+
"selectListItem" : "Owner.Alias",
|
64
|
+
"sortDirection" : null,
|
65
|
+
"sortIndex" : null,
|
66
|
+
"sortable" : true,
|
67
|
+
"type" : "string"
|
68
|
+
}, {
|
69
|
+
"ascendingLabel" : null,
|
70
|
+
"descendingLabel" : null,
|
71
|
+
"fieldNameOrPath" : "Id",
|
72
|
+
"hidden" : true,
|
73
|
+
"label" : "Account ID",
|
74
|
+
"selectListItem" : "Id",
|
75
|
+
"sortDirection" : null,
|
76
|
+
"sortIndex" : null,
|
77
|
+
"sortable" : false,
|
78
|
+
"type" : "id"
|
79
|
+
}, {
|
80
|
+
"ascendingLabel" : null,
|
81
|
+
"descendingLabel" : null,
|
82
|
+
"fieldNameOrPath" : "CreatedDate",
|
83
|
+
"hidden" : true,
|
84
|
+
"label" : "Created Date",
|
85
|
+
"selectListItem" : "CreatedDate",
|
86
|
+
"sortDirection" : null,
|
87
|
+
"sortIndex" : null,
|
88
|
+
"sortable" : false,
|
89
|
+
"type" : "datetime"
|
90
|
+
}, {
|
91
|
+
"ascendingLabel" : null,
|
92
|
+
"descendingLabel" : null,
|
93
|
+
"fieldNameOrPath" : "LastModifiedDate",
|
94
|
+
"hidden" : true,
|
95
|
+
"label" : "Last Modified Date",
|
96
|
+
"selectListItem" : "LastModifiedDate",
|
97
|
+
"sortDirection" : null,
|
98
|
+
"sortIndex" : null,
|
99
|
+
"sortable" : false,
|
100
|
+
"type" : "datetime"
|
101
|
+
}, {
|
102
|
+
"ascendingLabel" : null,
|
103
|
+
"descendingLabel" : null,
|
104
|
+
"fieldNameOrPath" : "SystemModstamp",
|
105
|
+
"hidden" : true,
|
106
|
+
"label" : "System Modstamp",
|
107
|
+
"selectListItem" : "SystemModstamp",
|
108
|
+
"sortDirection" : null,
|
109
|
+
"sortIndex" : null,
|
110
|
+
"sortable" : false,
|
111
|
+
"type" : "datetime"
|
112
|
+
} ],
|
113
|
+
"developerName" : "MyAccounts",
|
114
|
+
"done" : true,
|
115
|
+
"id" : "00BD0000005WcCN",
|
116
|
+
"label" : "My Accounts",
|
117
|
+
"records" : [ {
|
118
|
+
"columns" : [ {
|
119
|
+
"fieldNameOrPath" : "Name",
|
120
|
+
"value" : "Burlington Textiles Corp of America"
|
121
|
+
}, {
|
122
|
+
"fieldNameOrPath" : "Site",
|
123
|
+
"value" : null
|
124
|
+
}, {
|
125
|
+
"fieldNameOrPath" : "BillingState",
|
126
|
+
"value" : "NC"
|
127
|
+
}, {
|
128
|
+
"fieldNameOrPath" : "Phone",
|
129
|
+
"value" : "(336) 222-7000"
|
130
|
+
}, {
|
131
|
+
"fieldNameOrPath" : "Type",
|
132
|
+
"value" : "Customer - Direct"
|
133
|
+
}, {
|
134
|
+
"fieldNameOrPath" : "Owner.Alias",
|
135
|
+
"value" : "TUser"
|
136
|
+
}, {
|
137
|
+
"fieldNameOrPath" : "Id",
|
138
|
+
"value" : "001D000000JliSTIAZ"
|
139
|
+
}, {
|
140
|
+
"fieldNameOrPath" : "CreatedDate",
|
141
|
+
"value" : "Fri Aug 01 21:15:46 GMT 2014"
|
142
|
+
}, {
|
143
|
+
"fieldNameOrPath" : "LastModifiedDate",
|
144
|
+
"value" : "Fri Aug 01 21:15:46 GMT 2014"
|
145
|
+
}, {
|
146
|
+
"fieldNameOrPath" : "SystemModstamp",
|
147
|
+
"value" : "Fri Aug 01 21:15:46 GMT 2014"
|
148
|
+
} ]
|
149
|
+
} ],
|
150
|
+
"size" : 1
|
151
|
+
}
|
@@ -63,6 +63,24 @@ describe Restforce::Collection do
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
describe '#size' do
|
67
|
+
subject(:size) do
|
68
|
+
described_class.new(JSON.parse(fixture(sobject_fixture)), client).size
|
69
|
+
end
|
70
|
+
|
71
|
+
context 'when the query response contains a totalSize field' do
|
72
|
+
let(:sobject_fixture) { 'sobject/query_success_response' }
|
73
|
+
|
74
|
+
it { should eq 1 }
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when the query response contains a size field' do
|
78
|
+
let(:sobject_fixture) { 'sobject/list_view_results_success_response' }
|
79
|
+
|
80
|
+
it { should eq 1 }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
66
84
|
describe '#empty?' do
|
67
85
|
subject(:empty?) do
|
68
86
|
described_class.new(JSON.parse(fixture(sobject_fixture)), client).empty?
|
@@ -312,8 +312,11 @@ describe Restforce::Concerns::API do
|
|
312
312
|
let(:attrs) { { id: '1234', StageName: "Call Scheduled" } }
|
313
313
|
|
314
314
|
it 'sends an HTTP PATCH, and returns true' do
|
315
|
-
client.should_receive(:api_patch)
|
316
|
-
|
315
|
+
client.should_receive(:api_patch) do |*args|
|
316
|
+
expect(args).to eq(["sobjects/Whizbang/1234",
|
317
|
+
{ StageName: "Call Scheduled" }])
|
318
|
+
end
|
319
|
+
|
317
320
|
expect(result).to be true
|
318
321
|
end
|
319
322
|
end
|
@@ -322,8 +325,12 @@ describe Restforce::Concerns::API do
|
|
322
325
|
let(:attrs) { { id: '1234/?abc', StageName: "Call Scheduled" } }
|
323
326
|
|
324
327
|
it 'sends an HTTP PATCH, and encodes the ID' do
|
325
|
-
client.should_receive(:api_patch)
|
326
|
-
|
328
|
+
client.should_receive(:api_patch) do |*args|
|
329
|
+
expect(args).to eq(['sobjects/Whizbang/1234%2F%3Fabc', {
|
330
|
+
StageName: "Call Scheduled"
|
331
|
+
}])
|
332
|
+
end
|
333
|
+
|
327
334
|
expect(result).to be true
|
328
335
|
end
|
329
336
|
end
|
@@ -128,7 +128,7 @@ describe Restforce::Concerns::CompositeAPI do
|
|
128
128
|
describe '#composite' do
|
129
129
|
let(:method) { :composite }
|
130
130
|
let(:all_or_none) { false }
|
131
|
-
let(:response) { double('Faraday::Response', body: { '
|
131
|
+
let(:response) { double('Faraday::Response', body: { 'compositeResponse' => [] }) }
|
132
132
|
it_behaves_like 'composite requests'
|
133
133
|
end
|
134
134
|
|
@@ -136,7 +136,7 @@ describe Restforce::Concerns::CompositeAPI do
|
|
136
136
|
let(:method) { :composite! }
|
137
137
|
let(:all_or_none) { true }
|
138
138
|
let(:response) do
|
139
|
-
double('Faraday::Response', body: { '
|
139
|
+
double('Faraday::Response', body: { 'compositeResponse' => [] })
|
140
140
|
end
|
141
141
|
it_behaves_like 'composite requests'
|
142
142
|
end
|
data/spec/unit/config_spec.rb
CHANGED
@@ -44,7 +44,7 @@ describe Restforce do
|
|
44
44
|
'SALESFORCE_PROXY_URI' => 'proxy',
|
45
45
|
'SALESFORCE_HOST' => 'test.host.com',
|
46
46
|
'SALESFORCE_API_VERSION' => '37.0' }.
|
47
|
-
each { |var, value| ENV.stub(:
|
47
|
+
each { |var, value| ENV.stub(:fetch).with(var, anything).and_return(value) }
|
48
48
|
end
|
49
49
|
|
50
50
|
its(:username) { should eq 'foo' }
|
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: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Rogers
|
8
8
|
- Eric J. Holmes
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "<="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 1.10.0
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.9.0
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - "<="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
30
|
+
version: 1.10.0
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.9.0
|
@@ -93,9 +93,10 @@ executables: []
|
|
93
93
|
extensions: []
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
|
-
- ".circleci/config.yml"
|
97
96
|
- ".github/ISSUE_TEMPLATE/unhandled-salesforce-error.md"
|
98
97
|
- ".github/dependabot.yml"
|
98
|
+
- ".github/workflows/build.yml"
|
99
|
+
- ".github/workflows/faraday.yml"
|
99
100
|
- ".gitignore"
|
100
101
|
- ".rubocop.yml"
|
101
102
|
- ".rubocop_todo.yml"
|
@@ -170,6 +171,7 @@ files:
|
|
170
171
|
- spec/fixtures/sobject/get_deleted_success_response.json
|
171
172
|
- spec/fixtures/sobject/get_updated_success_response.json
|
172
173
|
- spec/fixtures/sobject/list_sobjects_success_response.json
|
174
|
+
- spec/fixtures/sobject/list_view_results_success_response.json
|
173
175
|
- spec/fixtures/sobject/org_query_response.json
|
174
176
|
- spec/fixtures/sobject/query_aggregate_success_response.json
|
175
177
|
- spec/fixtures/sobject/query_empty_response.json
|
@@ -239,7 +241,7 @@ metadata:
|
|
239
241
|
source_code_uri: https://github.com/restforce/restforce
|
240
242
|
changelog_uri: https://github.com/restforce/restforce/blob/master/CHANGELOG.md
|
241
243
|
rubygems_mfa_required: 'true'
|
242
|
-
post_install_message:
|
244
|
+
post_install_message:
|
243
245
|
rdoc_options: []
|
244
246
|
require_paths:
|
245
247
|
- lib
|
@@ -254,84 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
254
256
|
- !ruby/object:Gem::Version
|
255
257
|
version: '0'
|
256
258
|
requirements: []
|
257
|
-
rubygems_version: 3.
|
258
|
-
signing_key:
|
259
|
+
rubygems_version: 3.1.6
|
260
|
+
signing_key:
|
259
261
|
specification_version: 4
|
260
262
|
summary: A lightweight Ruby client for the Salesforce REST API
|
261
|
-
test_files:
|
262
|
-
- spec/fixtures/auth_error_response.json
|
263
|
-
- spec/fixtures/auth_success_response.json
|
264
|
-
- spec/fixtures/blob.jpg
|
265
|
-
- spec/fixtures/expired_session_response.json
|
266
|
-
- spec/fixtures/reauth_success_response.json
|
267
|
-
- spec/fixtures/refresh_error_response.json
|
268
|
-
- spec/fixtures/refresh_success_response.json
|
269
|
-
- spec/fixtures/services_data_success_response.json
|
270
|
-
- spec/fixtures/sobject/create_success_response.json
|
271
|
-
- spec/fixtures/sobject/delete_error_response.json
|
272
|
-
- spec/fixtures/sobject/describe_sobjects_success_response.json
|
273
|
-
- spec/fixtures/sobject/get_deleted_success_response.json
|
274
|
-
- spec/fixtures/sobject/get_updated_success_response.json
|
275
|
-
- spec/fixtures/sobject/list_sobjects_success_response.json
|
276
|
-
- spec/fixtures/sobject/org_query_response.json
|
277
|
-
- spec/fixtures/sobject/query_aggregate_success_response.json
|
278
|
-
- spec/fixtures/sobject/query_empty_response.json
|
279
|
-
- spec/fixtures/sobject/query_error_response.json
|
280
|
-
- spec/fixtures/sobject/query_paginated_first_page_response.json
|
281
|
-
- spec/fixtures/sobject/query_paginated_last_page_response.json
|
282
|
-
- spec/fixtures/sobject/query_success_response.json
|
283
|
-
- spec/fixtures/sobject/recent_success_response.json
|
284
|
-
- spec/fixtures/sobject/search_error_response.json
|
285
|
-
- spec/fixtures/sobject/search_success_response.json
|
286
|
-
- spec/fixtures/sobject/sobject_describe_error_response.json
|
287
|
-
- spec/fixtures/sobject/sobject_describe_success_response.json
|
288
|
-
- spec/fixtures/sobject/sobject_find_error_response.json
|
289
|
-
- spec/fixtures/sobject/sobject_find_success_response.json
|
290
|
-
- spec/fixtures/sobject/sobject_select_success_response.json
|
291
|
-
- spec/fixtures/sobject/upsert_created_success_response.json
|
292
|
-
- spec/fixtures/sobject/upsert_error_response.json
|
293
|
-
- spec/fixtures/sobject/upsert_multiple_error_response.json
|
294
|
-
- spec/fixtures/sobject/upsert_updated_success_response.json
|
295
|
-
- spec/fixtures/sobject/write_error_response.json
|
296
|
-
- spec/fixtures/test_private.key
|
297
|
-
- spec/integration/abstract_client_spec.rb
|
298
|
-
- spec/integration/data/client_spec.rb
|
299
|
-
- spec/spec_helper.rb
|
300
|
-
- spec/support/client_integration.rb
|
301
|
-
- spec/support/concerns.rb
|
302
|
-
- spec/support/event_machine.rb
|
303
|
-
- spec/support/fixture_helpers.rb
|
304
|
-
- spec/support/matchers.rb
|
305
|
-
- spec/support/middleware.rb
|
306
|
-
- spec/support/mock_cache.rb
|
307
|
-
- spec/unit/abstract_client_spec.rb
|
308
|
-
- spec/unit/attachment_spec.rb
|
309
|
-
- spec/unit/collection_spec.rb
|
310
|
-
- spec/unit/concerns/api_spec.rb
|
311
|
-
- spec/unit/concerns/authentication_spec.rb
|
312
|
-
- spec/unit/concerns/base_spec.rb
|
313
|
-
- spec/unit/concerns/batch_api_spec.rb
|
314
|
-
- spec/unit/concerns/caching_spec.rb
|
315
|
-
- spec/unit/concerns/canvas_spec.rb
|
316
|
-
- spec/unit/concerns/composite_api_spec.rb
|
317
|
-
- spec/unit/concerns/connection_spec.rb
|
318
|
-
- spec/unit/concerns/streaming_spec.rb
|
319
|
-
- spec/unit/config_spec.rb
|
320
|
-
- spec/unit/data/client_spec.rb
|
321
|
-
- spec/unit/document_spec.rb
|
322
|
-
- spec/unit/error_code_spec.rb
|
323
|
-
- spec/unit/mash_spec.rb
|
324
|
-
- spec/unit/middleware/authentication/jwt_bearer_spec.rb
|
325
|
-
- spec/unit/middleware/authentication/password_spec.rb
|
326
|
-
- spec/unit/middleware/authentication/token_spec.rb
|
327
|
-
- spec/unit/middleware/authentication_spec.rb
|
328
|
-
- spec/unit/middleware/authorization_spec.rb
|
329
|
-
- spec/unit/middleware/custom_headers_spec.rb
|
330
|
-
- spec/unit/middleware/gzip_spec.rb
|
331
|
-
- spec/unit/middleware/instance_url_spec.rb
|
332
|
-
- spec/unit/middleware/logger_spec.rb
|
333
|
-
- spec/unit/middleware/mashify_spec.rb
|
334
|
-
- spec/unit/middleware/raise_error_spec.rb
|
335
|
-
- spec/unit/signed_request_spec.rb
|
336
|
-
- spec/unit/sobject_spec.rb
|
337
|
-
- spec/unit/tooling/client_spec.rb
|
263
|
+
test_files: []
|
data/.circleci/config.yml
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
|
3
|
-
references:
|
4
|
-
steps: &steps
|
5
|
-
- checkout
|
6
|
-
|
7
|
-
- run:
|
8
|
-
name: Update Bundler
|
9
|
-
command: gem install bundler
|
10
|
-
|
11
|
-
- run:
|
12
|
-
name: Install dependencies from .gemspec
|
13
|
-
command: bundle install --jobs=4 --retry=3 --path vendor/bundle
|
14
|
-
|
15
|
-
- run:
|
16
|
-
name: Run RSpec tests
|
17
|
-
command: |
|
18
|
-
mkdir /tmp/test-results
|
19
|
-
|
20
|
-
bundle exec rspec --format progress \
|
21
|
-
--format RspecJunitFormatter \
|
22
|
-
--out /tmp/test-results/rspec.xml \
|
23
|
-
--format progress \
|
24
|
-
spec/**/*_spec.rb
|
25
|
-
|
26
|
-
- run:
|
27
|
-
name: Check code style with Rubocop
|
28
|
-
command: bundle exec rubocop
|
29
|
-
|
30
|
-
- store_test_results:
|
31
|
-
path: /tmp/test-results
|
32
|
-
- store_artifacts:
|
33
|
-
path: /tmp/test-results
|
34
|
-
destination: test-results
|
35
|
-
|
36
|
-
jobs:
|
37
|
-
build-ruby30:
|
38
|
-
docker:
|
39
|
-
- image: circleci/ruby:3.0
|
40
|
-
steps: *steps
|
41
|
-
build-ruby27:
|
42
|
-
docker:
|
43
|
-
- image: circleci/ruby:2.7
|
44
|
-
steps: *steps
|
45
|
-
build-ruby26:
|
46
|
-
docker:
|
47
|
-
- image: circleci/ruby:2.6
|
48
|
-
steps: *steps
|
49
|
-
|
50
|
-
workflows:
|
51
|
-
version: 2
|
52
|
-
tests:
|
53
|
-
jobs:
|
54
|
-
- build-ruby30
|
55
|
-
- build-ruby27
|
56
|
-
- build-ruby26
|