restforce 5.2.4 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfdaff5160d8845afd9c6ed3c384c7edf7d9ecb2593d562bae4d9a4812904137
4
- data.tar.gz: 8510146b906c8f7f0869a467db96d9bd3416446338a9d237d8c2e633c911cc35
3
+ metadata.gz: 54463ffbbbc7f62bb17637d0bd80f9ed54061333fff5a843e40c152613fbf34b
4
+ data.tar.gz: 22c2bf1bc1c516a1f31262901ef0c50c8a4417b2dc0c3838178649b220b481cd
5
5
  SHA512:
6
- metadata.gz: 592471696b0c585cb73bc26cca75267cfc7a2f3543f86449edd4e3ffc5401975cd4ded7cc7a20b63b5854434c06e6e63c48e0f49bf51839b8b8bee15e02113e8
7
- data.tar.gz: 71c9272a0799c6e899bbdd56a0380b6ae5b7112d11e56fb3860a10ca0ba0b1dfb9cf58bb25b0bf59ad8f8b38f50360f5f8ccbed4090afa194a67a19a7ae28318
6
+ metadata.gz: 82ecf32cf2ac55f42c20222a9d53d63ff595f96b591d46de3a0160b87d12a6c31a537c99dd6b08992f7ec1f58a21ba100ea14557660e57bd350eab965f5ef768
7
+ data.tar.gz: d33636c9271830f8acb4da01201c042ee9147e11cf4514ebc5a144311da350f2e3379469531801fe8e276ddfff2145c7f04f19a19cd77e304da56190b97cc270
@@ -4,16 +4,7 @@ updates:
4
4
  directory: "/"
5
5
  schedule:
6
6
  interval: daily
7
- open-pull-requests-limit: 10
8
- ignore:
9
- - dependency-name: rubocop
10
- versions:
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,8 @@
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
+
1
6
  # 5.2.4 (Mar 16, 2022)
2
7
 
3
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)
data/Gemfile CHANGED
@@ -3,6 +3,8 @@
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'
@@ -12,6 +14,6 @@ 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.26.0'
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
- [![CircleCI](https://circleci.com/gh/restforce/restforce.svg?style=svg)](https://circleci.com/gh/restforce/restforce) [![Code Climate](https://codeclimate.com/github/restforce/restforce.png)](https://codeclimate.com/github/restforce/restforce) [![Dependency Status](https://gemnasium.com/restforce/restforce.png)](https://gemnasium.com/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.2.4'
30
+ gem 'restforce', '~> 5.3.0'
31
31
 
32
32
  And then execute:
33
33
 
@@ -91,29 +91,31 @@ module Restforce
91
91
  end
92
92
  end
93
93
 
94
- option :api_version, default: lambda { ENV['SALESFORCE_API_VERSION'] || '26.0' }
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['SALESFORCE_USERNAME'] }
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['SALESFORCE_PASSWORD'] }
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 { ENV['SALESFORCE_SECURITY_TOKEN'] }
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['SALESFORCE_CLIENT_ID'] }
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['SALESFORCE_CLIENT_SECRET'] }
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['SALESFORCE_HOST'] || 'login.salesforce.com' }
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['SALESFORCE_PROXY_URI'] }
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
@@ -1,9 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- begin
4
- require 'faraday/file_part'
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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Restforce
4
- VERSION = '5.2.4'
4
+ VERSION = '5.3.0'
5
5
  end
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', '< 1.9.0', '>= 0.9.0'
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']
@@ -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
- with('sobjects/Whizbang/1234', StageName: "Call Scheduled")
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
- with('sobjects/Whizbang/1234%2F%3Fabc', StageName: "Call Scheduled")
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
@@ -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(:[]).with(var).and_return(value) }
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.2.4
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: 2022-03-16 00:00:00.000000000 Z
12
+ date: 2022-05-30 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.9.0
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.9.0
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"
@@ -240,7 +241,7 @@ metadata:
240
241
  source_code_uri: https://github.com/restforce/restforce
241
242
  changelog_uri: https://github.com/restforce/restforce/blob/master/CHANGELOG.md
242
243
  rubygems_mfa_required: 'true'
243
- post_install_message:
244
+ post_install_message:
244
245
  rdoc_options: []
245
246
  require_paths:
246
247
  - lib
@@ -255,85 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
256
  - !ruby/object:Gem::Version
256
257
  version: '0'
257
258
  requirements: []
258
- rubygems_version: 3.3.3
259
- signing_key:
259
+ rubygems_version: 3.1.6
260
+ signing_key:
260
261
  specification_version: 4
261
262
  summary: A lightweight Ruby client for the Salesforce REST API
262
- test_files:
263
- - spec/fixtures/auth_error_response.json
264
- - spec/fixtures/auth_success_response.json
265
- - spec/fixtures/blob.jpg
266
- - spec/fixtures/expired_session_response.json
267
- - spec/fixtures/reauth_success_response.json
268
- - spec/fixtures/refresh_error_response.json
269
- - spec/fixtures/refresh_success_response.json
270
- - spec/fixtures/services_data_success_response.json
271
- - spec/fixtures/sobject/create_success_response.json
272
- - spec/fixtures/sobject/delete_error_response.json
273
- - spec/fixtures/sobject/describe_sobjects_success_response.json
274
- - spec/fixtures/sobject/get_deleted_success_response.json
275
- - spec/fixtures/sobject/get_updated_success_response.json
276
- - spec/fixtures/sobject/list_sobjects_success_response.json
277
- - spec/fixtures/sobject/list_view_results_success_response.json
278
- - spec/fixtures/sobject/org_query_response.json
279
- - spec/fixtures/sobject/query_aggregate_success_response.json
280
- - spec/fixtures/sobject/query_empty_response.json
281
- - spec/fixtures/sobject/query_error_response.json
282
- - spec/fixtures/sobject/query_paginated_first_page_response.json
283
- - spec/fixtures/sobject/query_paginated_last_page_response.json
284
- - spec/fixtures/sobject/query_success_response.json
285
- - spec/fixtures/sobject/recent_success_response.json
286
- - spec/fixtures/sobject/search_error_response.json
287
- - spec/fixtures/sobject/search_success_response.json
288
- - spec/fixtures/sobject/sobject_describe_error_response.json
289
- - spec/fixtures/sobject/sobject_describe_success_response.json
290
- - spec/fixtures/sobject/sobject_find_error_response.json
291
- - spec/fixtures/sobject/sobject_find_success_response.json
292
- - spec/fixtures/sobject/sobject_select_success_response.json
293
- - spec/fixtures/sobject/upsert_created_success_response.json
294
- - spec/fixtures/sobject/upsert_error_response.json
295
- - spec/fixtures/sobject/upsert_multiple_error_response.json
296
- - spec/fixtures/sobject/upsert_updated_success_response.json
297
- - spec/fixtures/sobject/write_error_response.json
298
- - spec/fixtures/test_private.key
299
- - spec/integration/abstract_client_spec.rb
300
- - spec/integration/data/client_spec.rb
301
- - spec/spec_helper.rb
302
- - spec/support/client_integration.rb
303
- - spec/support/concerns.rb
304
- - spec/support/event_machine.rb
305
- - spec/support/fixture_helpers.rb
306
- - spec/support/matchers.rb
307
- - spec/support/middleware.rb
308
- - spec/support/mock_cache.rb
309
- - spec/unit/abstract_client_spec.rb
310
- - spec/unit/attachment_spec.rb
311
- - spec/unit/collection_spec.rb
312
- - spec/unit/concerns/api_spec.rb
313
- - spec/unit/concerns/authentication_spec.rb
314
- - spec/unit/concerns/base_spec.rb
315
- - spec/unit/concerns/batch_api_spec.rb
316
- - spec/unit/concerns/caching_spec.rb
317
- - spec/unit/concerns/canvas_spec.rb
318
- - spec/unit/concerns/composite_api_spec.rb
319
- - spec/unit/concerns/connection_spec.rb
320
- - spec/unit/concerns/streaming_spec.rb
321
- - spec/unit/config_spec.rb
322
- - spec/unit/data/client_spec.rb
323
- - spec/unit/document_spec.rb
324
- - spec/unit/error_code_spec.rb
325
- - spec/unit/mash_spec.rb
326
- - spec/unit/middleware/authentication/jwt_bearer_spec.rb
327
- - spec/unit/middleware/authentication/password_spec.rb
328
- - spec/unit/middleware/authentication/token_spec.rb
329
- - spec/unit/middleware/authentication_spec.rb
330
- - spec/unit/middleware/authorization_spec.rb
331
- - spec/unit/middleware/custom_headers_spec.rb
332
- - spec/unit/middleware/gzip_spec.rb
333
- - spec/unit/middleware/instance_url_spec.rb
334
- - spec/unit/middleware/logger_spec.rb
335
- - spec/unit/middleware/mashify_spec.rb
336
- - spec/unit/middleware/raise_error_spec.rb
337
- - spec/unit/signed_request_spec.rb
338
- - spec/unit/sobject_spec.rb
339
- - 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