restforce 5.2.3 → 5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +13 -0
- data/Gemfile +4 -2
- data/README.md +5 -3
- data/lib/restforce/collection.rb +5 -1
- data/lib/restforce/concerns/api.rb +1 -0
- data/lib/restforce/config.rb +10 -8
- data/lib/restforce/error_code.rb +3 -0
- 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/config_spec.rb +1 -1
- metadata +14 -88
- data/.circleci/config.yml +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7156aa3b1821199121b06cbf84b2c00039efeddc17cc58cbe1d8454bddbf1eb7
|
4
|
+
data.tar.gz: 8cfbd9d725041f02fa8abd45cc08254a38e563dce206747f0c778bd6c91c3306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cf147d56213c10144b4e7819f6e5a62961a84c134b66f7b506d4f76bb8aad4563c7d69b39702e06b468441c35dafac4c8e1d74a65c3c76e7c47cab76ef58080
|
7
|
+
data.tar.gz: 1351ded2015aca8bd6c8f89ab8c28c684c125b7aa2fd0c077660072064e96b4a1d917d401c9df1cd99873d12780866ba9811d23e228d185e8b6dc426c14c6aaa
|
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.0.1', '1.1.0', '1.2.0', '1.3.1', '1.4.1', '1.5.1', '1.6.0', '1.7.2', '1.8.0', '1.9.3', '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,16 @@
|
|
1
|
+
# 5.3.1 (Jul 19 2022)
|
2
|
+
|
3
|
+
* Handle the `EXCEEDED_ID_LIMIT` error returned by the Salesforce API (@timrogers, @yashshah1)
|
4
|
+
|
5
|
+
# 5.3.0 (May 30, 2022)
|
6
|
+
|
7
|
+
* Add support for Faraday v1.9.x and v1.10.0 (@magni-, @timrogers)
|
8
|
+
* Follow redirects during authentication to support Lightning URLs (e.g. `*.lightning.force.com` instead of `*.my.salesforce.com`) (@nhocki)
|
9
|
+
|
10
|
+
# 5.2.4 (Mar 16, 2022)
|
11
|
+
|
12
|
+
* Fix `Restforce::Collection#size` for Salesforce APIs that use the `size` property to return the total number of results, instead of `totalSize` (@kwong-yw)
|
13
|
+
|
1
14
|
# 5.2.3 (Jan 17, 2022)
|
2
15
|
|
3
16
|
* Add official support for Ruby 3.1 (@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
16
|
gem 'rspec_junit_formatter', '~> 0.5.1'
|
15
|
-
gem 'rubocop', '~> 1.
|
17
|
+
gem 'rubocop', '~> 1.31.2'
|
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
|
-
[![CircleCI](https://circleci.com/gh/restforce/restforce.svg?style=svg)](https://circleci.com/gh/restforce/restforce)
|
4
|
-
![](https://img.shields.io/gem/dt/restforce.svg)
|
3
|
+
[![CircleCI](https://circleci.com/gh/restforce/restforce.svg?style=svg)](https://circleci.com/gh/restforce/restforce)
|
4
|
+
![Downloads](https://img.shields.io/gem/dt/restforce.svg)
|
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.1'
|
31
31
|
|
32
32
|
And then execute:
|
33
33
|
|
@@ -293,6 +293,8 @@ client.find('Account', '1234', 'Some_External_Id_Field__c')
|
|
293
293
|
# => #<Restforce::SObject Id="001D000000INjVe" Name="Test" LastModifiedBy="005G0000002f8FHIAY" ... >
|
294
294
|
```
|
295
295
|
|
296
|
+
`find` raises an error if nothing is found.
|
297
|
+
|
296
298
|
### select
|
297
299
|
|
298
300
|
`select` allows the fetching of a specific list of fields from a single object. It requires an `external_id` lookup, but is often much faster than an arbitrary query.
|
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
|
|
@@ -429,6 +429,7 @@ module Restforce
|
|
429
429
|
# field - External ID field to use (default: nil).
|
430
430
|
#
|
431
431
|
# Returns the Restforce::SObject sobject record.
|
432
|
+
# Raises NotFoundError if nothing is found.
|
432
433
|
def find(sobject, id, field = nil)
|
433
434
|
url = if field
|
434
435
|
"sobjects/#{sobject}/#{field}/#{ERB::Util.url_encode(id)}"
|
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/error_code.rb
CHANGED
@@ -145,6 +145,8 @@ module Restforce
|
|
145
145
|
|
146
146
|
class ErrorInMailer < ResponseError; end
|
147
147
|
|
148
|
+
class ExceededIdLimit < ResponseError; end
|
149
|
+
|
148
150
|
class ExceededMaxSemijoinSubselects < ResponseError; end
|
149
151
|
|
150
152
|
class FailedActivation < ResponseError; end
|
@@ -484,6 +486,7 @@ module Restforce
|
|
484
486
|
"ENTITY_IS_LOCKED" => EntityIsLocked,
|
485
487
|
"ENVIRONMENT_HUB_MEMBERSHIP_CONFLICT" => EnvironmentHubMembershipConflict,
|
486
488
|
"ERROR_IN_MAILER" => ErrorInMailer,
|
489
|
+
"EXCEEDED_ID_LIMIT" => ExceededIdLimit,
|
487
490
|
"EXCEEDED_MAX_SEMIJOIN_SUBSELECTS" => ExceededMaxSemijoinSubselects,
|
488
491
|
"FAILED_ACTIVATION" => FailedActivation,
|
489
492
|
"FIELD_CUSTOM_VALIDATION_EXCEPTION" => FieldCustomValidationException,
|
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
|
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,23 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.1
|
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: 2022-
|
12
|
+
date: 2022-07-19 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
|
-
- - "
|
18
|
+
- - "<="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.10.0
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.9.0
|
@@ -25,9 +25,9 @@ dependencies:
|
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- - "
|
28
|
+
- - "<="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 1.
|
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,61 +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-ruby31:
|
38
|
-
docker:
|
39
|
-
- image: cimg/ruby:3.1
|
40
|
-
steps: *steps
|
41
|
-
build-ruby30:
|
42
|
-
docker:
|
43
|
-
- image: cimg/ruby:3.0
|
44
|
-
steps: *steps
|
45
|
-
build-ruby27:
|
46
|
-
docker:
|
47
|
-
- image: cimg/ruby:2.7
|
48
|
-
steps: *steps
|
49
|
-
build-ruby26:
|
50
|
-
docker:
|
51
|
-
- image: cimg/ruby:2.6
|
52
|
-
steps: *steps
|
53
|
-
|
54
|
-
workflows:
|
55
|
-
version: 2
|
56
|
-
tests:
|
57
|
-
jobs:
|
58
|
-
- build-ruby31
|
59
|
-
- build-ruby30
|
60
|
-
- build-ruby27
|
61
|
-
- build-ruby26
|