restforce 6.2.1 → 6.2.2

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: 5b88661434383f16571c2b240a9c2482035058a34adadfe39a86b4fecb7382ca
4
- data.tar.gz: bb4ac026f9b7fbd43f7b5237760e341d9d351c5433ca19009daa24794be251f0
3
+ metadata.gz: 18f985dc2a3f2b1776f442009e24453e35c19d946f1d0f6ecdd42af56693c8ca
4
+ data.tar.gz: a9ab15688f2eaf7122b57bdca9bdbd54724983f6c38ee311aed095cd7ed3c950
5
5
  SHA512:
6
- metadata.gz: da66afd00a69c078e3883f76ae0039d2742911de7b0ca8cb6b14b15801695973a25deec7e71fede838d9193a60224510eee625b72b06c827d6f0467111757023
7
- data.tar.gz: 86cad2e9fecc5610dae221bdec91a8a1868b9333d7aa552b5fb21af928352c73cad50ea64f63f26cd61ea50048784f5c3dad20b04d798c70aee2f0295c1721bd
6
+ metadata.gz: 22bdd50789784b18f20dabaa86358db0d05e37e630770ea70da379b5c3410059b8b003e7e8a26347c3ee0141f8b81dc1d422d796454e32bca7531b9f81f72041
7
+ data.tar.gz: 520de3d9f192d6f658fc8bca961975550432054b8c6db5710a5198bb7947c0b485b5a9ff112a1e4cf1848a13344f6cdc0adb2ef498a2ea5175c76582f4bdd395
@@ -10,7 +10,7 @@ jobs:
10
10
  # For v2.0.x, we test v2.0.0 and v2.0.1 because v2.0.0 has a special behaviour where
11
11
  # the Net::HTTP adapter is not included. See
12
12
  # https://github.com/lostisland/faraday/blob/main/UPGRADING.md#faraday-20.
13
- faraday_version: ['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', '2.0.0', '2.0.1', '2.1.0', '2.2.0', '2.3.0', '2.4.0', '2.5.0', '2.6.0', '2.7.0']
13
+ faraday_version: ['1.1.0', '1.2.0', '1.3.1', '1.4.3', '1.5.1', '1.6.0', '1.7.2', '1.8.0', '1.9.3', '1.10.3', '2.0.0', '2.0.1', '2.1.0', '2.2.0', '2.3.0', '2.4.0', '2.5.2', '2.6.0', '2.7.4']
14
14
  env:
15
15
  FARADAY_VERSION: ~> ${{ matrix.faraday_version }}
16
16
  steps:
@@ -24,4 +24,4 @@ jobs:
24
24
  - name: Install dependencies
25
25
  run: bundle install
26
26
  - name: Run RSpec tests
27
- run: bundle exec rspec
27
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -19,3 +19,6 @@ tmp
19
19
  .rspec
20
20
  .ruby-version
21
21
  *.swp
22
+ .idea
23
+ Vagrantfile
24
+ .vagrant/
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 6.2.2 (Mar 24 2023)
2
+
3
+ * Handle the `INSUFFICIENT_ACCESS` error returned by the Salesforce API (@timrogers, @nstuart-at-salesforce)
4
+
1
5
  # 6.2.1 (Jan 18 2023)
2
6
 
3
7
  * When a response claims to be gzipped but isn't, return the body as it is and don't explode (@timrogers)
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ faraday_version = ENV.fetch('FARADAY_VERSION', '~> 2.7.3')
7
7
 
8
8
  # Enable us to explicitly pick a Faraday version when running tests
9
9
  gem 'faraday', faraday_version
10
- gem 'faraday-typhoeus', '~> 0.2.1' unless faraday_version.start_with?("~> 1")
10
+ gem 'faraday-typhoeus', '~> 1.0.0' unless faraday_version.start_with?("~> 1")
11
11
  gem 'faye' unless RUBY_PLATFORM == 'java'
12
12
  gem 'guard-rspec'
13
13
  gem 'guard-rubocop'
@@ -17,6 +17,6 @@ gem 'rspec', '~> 3.12.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.43.0'
20
+ gem 'rubocop', '~> 1.48.0'
21
21
  gem 'simplecov', '~> 0.22.0'
22
22
  gem 'webmock', '~> 3.18.1'
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', '~> 6.2.1'
30
+ gem 'restforce', '~> 6.2.2'
31
31
 
32
32
  And then execute:
33
33
 
@@ -112,12 +112,13 @@ The `id` field can be used to [uniquely identify](https://developer.salesforce.c
112
112
  If you prefer to use a username and password to authenticate:
113
113
 
114
114
  ```ruby
115
- client = Restforce.new(username: 'foo',
116
- password: 'bar',
117
- security_token: 'security token',
118
- client_id: 'client_id',
119
- client_secret: 'client_secret',
120
- api_version: '41.0')
115
+ client = Restforce.new(username: config['username'],
116
+ password: config['password'],
117
+ instance_url: config['instance_url'],
118
+ host: config['host'], # https://test.salesforce.com for sandbox (optional)
119
+ client_id: config['client_key'], # Salesforce Client Key
120
+ client_secret: config['client_secret'], # Salesforce Client Secret
121
+ api_version: '55.0')
121
122
  ```
122
123
 
123
124
  #### JWT Bearer Token
@@ -57,6 +57,11 @@ module Restforce
57
57
  #
58
58
  # :request_headers - A hash containing custom headers that will be
59
59
  # appended to each request
60
+ #
61
+ # :clear_authorization_header - A boolean that when set to true will cause
62
+ # the Faraday::FollowRedirects middleware to
63
+ # omit the auth header when following
64
+ # redirects (default: false)
60
65
 
61
66
  def initialize(opts = {})
62
67
  raise ArgumentError, 'Please specify a hash of options' unless opts.is_a?(Hash)
@@ -20,6 +20,8 @@ module Restforce
20
20
  private
21
21
 
22
22
  # Internal: Internal faraday connection where all requests go through
23
+ # rubocop:disable Metrics/AbcSize
24
+ # rubocop:disable Metrics/BlockLength
23
25
  def connection
24
26
  @connection ||= Faraday.new(options[:instance_url],
25
27
  connection_options) do |builder|
@@ -43,7 +45,10 @@ module Restforce
43
45
  # Caches GET requests.
44
46
  builder.use Restforce::Middleware::Caching, cache, options if cache
45
47
  # Follows 30x redirects.
46
- builder.use Faraday::FollowRedirects::Middleware
48
+ builder.use Faraday::FollowRedirects::Middleware, {
49
+ # Pass the option to clear or send the auth header on redirects through
50
+ clear_authorization_header: options[:clear_authorization_header]
51
+ }
47
52
  # Raises errors for 40x responses.
48
53
  builder.use Restforce::Middleware::RaiseError
49
54
  # Parses returned JSON response into a hash.
@@ -64,6 +69,8 @@ module Restforce
64
69
  builder.adapter adapter
65
70
  end
66
71
  end
72
+ # rubocop:enable Metrics/BlockLength
73
+ # rubocop:enable Metrics/AbcSize
67
74
 
68
75
  def adapter
69
76
  options[:adapter]
@@ -161,6 +161,10 @@ module Restforce
161
161
  # Set use_cache to false to opt in to caching with client.with_caching
162
162
  option :use_cache, default: true
163
163
 
164
+ # Set to true to have Faraday::FollowRedirects middleware omit the auth header
165
+ # when following redirects
166
+ option :clear_authorization_header, default: false
167
+
164
168
  def options
165
169
  self.class.options
166
170
  end
@@ -171,6 +171,8 @@ module Restforce
171
171
 
172
172
  class InsertUpdateDeleteNotAllowedDuringMaintenance < ResponseError; end
173
173
 
174
+ class InsufficientAccess < ResponseError; end
175
+
174
176
  class InsufficientAccessOnCrossReferenceEntity < ResponseError; end
175
177
 
176
178
  class InsufficientAccessOrReadonly < ResponseError; end
@@ -500,6 +502,8 @@ module Restforce
500
502
  "INACTIVE_OWNER_OR_USER" => InactiveOwnerOrUser,
501
503
  "INSERT_UPDATE_DELETE_NOT_ALLOWED_DURING_MAINTENANCE" =>
502
504
  InsertUpdateDeleteNotAllowedDuringMaintenance,
505
+ "INSUFFICIENT_ACCESS" =>
506
+ InsufficientAccess,
503
507
  "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" =>
504
508
  InsufficientAccessOnCrossReferenceEntity,
505
509
  "INSUFFICIENT_ACCESS_OR_READONLY" => InsufficientAccessOrReadonly,
@@ -29,4 +29,6 @@ end
29
29
 
30
30
  # This patch is only needed with multipart-post < 2.0.0
31
31
  # 2.0.0 was released in 2013.
32
- require 'restforce/patches/parts' unless Parts::Part.method(:new).arity.abs == 4
32
+ if defined?(Parts) && Parts::Part.method(:new).arity.abs != 4
33
+ require 'restforce/patches/parts'
34
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Restforce
4
- VERSION = '6.2.1'
4
+ VERSION = '6.2.2'
5
5
  end
@@ -62,7 +62,7 @@ describe Restforce do
62
62
  %i[username password security_token client_id client_secret compress
63
63
  timeout oauth_token refresh_token instance_url api_version host mashify
64
64
  authentication_retries proxy_uri authentication_callback ssl
65
- request_headers log_level logger].each do |attr|
65
+ request_headers log_level logger clear_authorization_header].each do |attr|
66
66
  it "allows #{attr} to be set" do
67
67
  Restforce.configure do |config|
68
68
  config.send("#{attr}=", 'foobar')
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: 6.2.1
4
+ version: 6.2.2
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: 2023-01-18 00:00:00.000000000 Z
12
+ date: 2023-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -293,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
293
293
  - !ruby/object:Gem::Version
294
294
  version: '0'
295
295
  requirements: []
296
- rubygems_version: 3.4.1
296
+ rubygems_version: 3.4.7
297
297
  signing_key:
298
298
  specification_version: 4
299
299
  summary: A lightweight Ruby client for the Salesforce REST API