restforce 6.2.1 → 6.2.3
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/workflows/faraday.yml +2 -2
- data/.gitignore +3 -0
- data/CHANGELOG.md +9 -1
- data/Gemfile +2 -2
- data/README.md +8 -7
- data/lib/restforce/concerns/base.rb +5 -0
- data/lib/restforce/concerns/connection.rb +8 -1
- data/lib/restforce/config.rb +4 -0
- data/lib/restforce/error_code.rb +19 -0
- data/lib/restforce/file_part.rb +3 -1
- data/lib/restforce/version.rb +1 -1
- data/spec/unit/config_spec.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: fb14e30b8ad47c0d7fd1090e75181ebf8c47a01ae5d59ec574cb4d00842288ad
         | 
| 4 | 
            +
              data.tar.gz: 69e1bbb2a318dd71b20c38a23aef43f94e29285a6a9d979aca97b16a30c85afb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a15b13f4cb356c77aa571e9421bad05cb8056ed807df0ae746f81fa58c310869dd61c439b20808214e52500c4fa0be2ba754103a3d16fda710de3497995c51ac
         | 
| 7 | 
            +
              data.tar.gz: 46ffc1a1e53a30c578c28895f401b6dcdc3c2b9846293c452c2d4c7f5a8aee838ca04d6d7bd9b159a69f399ef4c8cc9e75988e5ea39d9926f5ef5f0b92f1991a
         | 
| @@ -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. | 
| 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
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,11 @@ | |
| 1 | 
            +
            # 6.2.3 (Jun 18 2023)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Handle the `CANNOT_DELETE_OWNER`, `CANNOT_POST_TO_ARCHIVED_GROUP`, `INVALID_INPUT`, `INVALID_MARKUP` and `INVALID_SEARCH` errors returned by the Salesforce API (@spurton)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # 6.2.2 (Mar 24 2023)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * Handle the `INSUFFICIENT_ACCESS` error returned by the Salesforce API (@timrogers, @nstuart-at-salesforce)
         | 
| 8 | 
            +
             | 
| 1 9 | 
             
            # 6.2.1 (Jan 18 2023)
         | 
| 2 10 |  | 
| 3 11 | 
             
            * When a response claims to be gzipped but isn't, return the body as it is and don't explode (@timrogers)
         | 
| @@ -5,7 +13,7 @@ | |
| 5 13 | 
             
            # 6.2.0 (Jan 18 2023)
         | 
| 6 14 |  | 
| 7 15 | 
             
            * Add support for `faraday` v2.7.x (@timrogers)
         | 
| 8 | 
            -
            * Expose the Faraday `Response` on `CompositeAPIError`s (@shravan097)
         | 
| 16 | 
            +
            * Expose the Faraday `Response` on` `CompositeAPIError`s (@shravan097)
         | 
| 9 17 |  | 
| 10 18 | 
             
            # 6.1.0 (Nov 18 2022)
         | 
| 11 19 |  | 
    
        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. | 
| 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. | 
| 20 | 
            +
            gem 'rubocop', '~> 1.52.1'
         | 
| 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. | 
| 30 | 
            +
                gem 'restforce', '~> 6.2.3'
         | 
| 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: ' | 
| 116 | 
            -
                                   password: ' | 
| 117 | 
            -
                                    | 
| 118 | 
            -
                                    | 
| 119 | 
            -
                                    | 
| 120 | 
            -
                                    | 
| 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]
         | 
    
        data/lib/restforce/config.rb
    CHANGED
    
    | @@ -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
         | 
    
        data/lib/restforce/error_code.rb
    CHANGED
    
    | @@ -43,6 +43,8 @@ module Restforce | |
| 43 43 |  | 
| 44 44 | 
             
                class CannotDeleteLastDatedConversionRate < ResponseError; end
         | 
| 45 45 |  | 
| 46 | 
            +
                class CannotDeleteOwner < ResponseError; end
         | 
| 47 | 
            +
             | 
| 46 48 | 
             
                class CannotDeleteManagedObject < ResponseError; end
         | 
| 47 49 |  | 
| 48 50 | 
             
                class CannotDisableLastAdmin < ResponseError; end
         | 
| @@ -55,6 +57,8 @@ module Restforce | |
| 55 57 |  | 
| 56 58 | 
             
                class CannotModifyManagedObject < ResponseError; end
         | 
| 57 59 |  | 
| 60 | 
            +
                class CannotPostToArchivedGroup < ResponseError; end
         | 
| 61 | 
            +
             | 
| 58 62 | 
             
                class CannotRenameApexReferencedField < ResponseError; end
         | 
| 59 63 |  | 
| 60 64 | 
             
                class CannotRenameApexReferencedObject < ResponseError; end
         | 
| @@ -171,6 +175,8 @@ module Restforce | |
| 171 175 |  | 
| 172 176 | 
             
                class InsertUpdateDeleteNotAllowedDuringMaintenance < ResponseError; end
         | 
| 173 177 |  | 
| 178 | 
            +
                class InsufficientAccess < ResponseError; end
         | 
| 179 | 
            +
             | 
| 174 180 | 
             
                class InsufficientAccessOnCrossReferenceEntity < ResponseError; end
         | 
| 175 181 |  | 
| 176 182 | 
             
                class InsufficientAccessOrReadonly < ResponseError; end
         | 
| @@ -217,8 +223,12 @@ module Restforce | |
| 217 223 |  | 
| 218 224 | 
             
                class InvalidInetAddress < ResponseError; end
         | 
| 219 225 |  | 
| 226 | 
            +
                class InvalidInput < ResponseError; end
         | 
| 227 | 
            +
             | 
| 220 228 | 
             
                class InvalidLineitemCloneState < ResponseError; end
         | 
| 221 229 |  | 
| 230 | 
            +
                class InvalidMarkup < ResponseError; end
         | 
| 231 | 
            +
             | 
| 222 232 | 
             
                class InvalidMasterOrTranslatedSolution < ResponseError; end
         | 
| 223 233 |  | 
| 224 234 | 
             
                class InvalidMessageIdReference < ResponseError; end
         | 
| @@ -245,6 +255,8 @@ module Restforce | |
| 245 255 |  | 
| 246 256 | 
             
                class InvalidSaveAsActivityFlag < ResponseError; end
         | 
| 247 257 |  | 
| 258 | 
            +
                class InvalidSearch < ResponseError; end
         | 
| 259 | 
            +
             | 
| 248 260 | 
             
                class InvalidSessionId < ResponseError; end
         | 
| 249 261 |  | 
| 250 262 | 
             
                class InvalidSignupCountry < ResponseError; end
         | 
| @@ -434,11 +446,13 @@ module Restforce | |
| 434 446 | 
             
                  "CANNOT_DELETE_LAST_DATED_CONVERSION_RATE" =>
         | 
| 435 447 | 
             
               CannotDeleteLastDatedConversionRate,
         | 
| 436 448 | 
             
                  "CANNOT_DELETE_MANAGED_OBJECT" => CannotDeleteManagedObject,
         | 
| 449 | 
            +
                  "CANNOT_DELETE_OWNER" => CannotDeleteOwner,
         | 
| 437 450 | 
             
                  "CANNOT_DISABLE_LAST_ADMIN" => CannotDisableLastAdmin,
         | 
| 438 451 | 
             
                  "CANNOT_ENABLE_IP_RESTRICT_REQUESTS" => CannotEnableIpRestrictRequests,
         | 
| 439 452 | 
             
                  "CANNOT_EXECUTE_FLOW_TRIGGER" => CannotExecuteFlowTrigger,
         | 
| 440 453 | 
             
                  "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY" => CannotInsertUpdateActivateEntity,
         | 
| 441 454 | 
             
                  "CANNOT_MODIFY_MANAGED_OBJECT" => CannotModifyManagedObject,
         | 
| 455 | 
            +
                  "CANNOT_POST_TO_ARCHIVED_GROUP" => CannotPostToArchivedGroup,
         | 
| 442 456 | 
             
                  "CANNOT_RENAME_APEX_REFERENCED_FIELD" => CannotRenameApexReferencedField,
         | 
| 443 457 | 
             
                  "CANNOT_RENAME_APEX_REFERENCED_OBJECT" => CannotRenameApexReferencedObject,
         | 
| 444 458 | 
             
                  "CANNOT_REPARENT_RECORD" => CannotReparentRecord,
         | 
| @@ -500,6 +514,8 @@ module Restforce | |
| 500 514 | 
             
                  "INACTIVE_OWNER_OR_USER" => InactiveOwnerOrUser,
         | 
| 501 515 | 
             
                  "INSERT_UPDATE_DELETE_NOT_ALLOWED_DURING_MAINTENANCE" =>
         | 
| 502 516 | 
             
               InsertUpdateDeleteNotAllowedDuringMaintenance,
         | 
| 517 | 
            +
                  "INSUFFICIENT_ACCESS" =>
         | 
| 518 | 
            +
               InsufficientAccess,
         | 
| 503 519 | 
             
                  "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" =>
         | 
| 504 520 | 
             
               InsufficientAccessOnCrossReferenceEntity,
         | 
| 505 521 | 
             
                  "INSUFFICIENT_ACCESS_OR_READONLY" => InsufficientAccessOrReadonly,
         | 
| @@ -524,7 +540,9 @@ module Restforce | |
| 524 540 | 
             
                  "INVALID_FILTER_ACTION" => InvalidFilterAction,
         | 
| 525 541 | 
             
                  "INVALID_ID_FIELD" => InvalidIdField,
         | 
| 526 542 | 
             
                  "INVALID_INET_ADDRESS" => InvalidInetAddress,
         | 
| 543 | 
            +
                  "INVALID_INPUT" => InvalidInput,
         | 
| 527 544 | 
             
                  "INVALID_LINEITEM_CLONE_STATE" => InvalidLineitemCloneState,
         | 
| 545 | 
            +
                  "INVALID_MARKUP" => InvalidMarkup,
         | 
| 528 546 | 
             
                  "INVALID_MASTER_OR_TRANSLATED_SOLUTION" => InvalidMasterOrTranslatedSolution,
         | 
| 529 547 | 
             
                  "INVALID_MESSAGE_ID_REFERENCE" => InvalidMessageIdReference,
         | 
| 530 548 | 
             
                  "INVALID_OPERATION" => InvalidOperation,
         | 
| @@ -539,6 +557,7 @@ module Restforce | |
| 539 557 | 
             
                  "INVALID_READ_ONLY_USER_DML" => InvalidReadOnlyUserDml,
         | 
| 540 558 | 
             
                  "INVALID_REPLICATION_DATE" => InvalidReplicationDate,
         | 
| 541 559 | 
             
                  "INVALID_SAVE_AS_ACTIVITY_FLAG" => InvalidSaveAsActivityFlag,
         | 
| 560 | 
            +
                  "INVALID_SEARCH" => InvalidSearch,
         | 
| 542 561 | 
             
                  "INVALID_SESSION_ID" => InvalidSessionId,
         | 
| 543 562 | 
             
                  "INVALID_SIGNUP_COUNTRY" => InvalidSignupCountry,
         | 
| 544 563 | 
             
                  "INVALID_STATUS" => InvalidStatus,
         | 
    
        data/lib/restforce/file_part.rb
    CHANGED
    
    | @@ -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 | 
            -
             | 
| 32 | 
            +
            if defined?(Parts) && Parts::Part.method(:new).arity.abs != 4
         | 
| 33 | 
            +
              require 'restforce/patches/parts'
         | 
| 34 | 
            +
            end
         | 
    
        data/lib/restforce/version.rb
    CHANGED
    
    
    
        data/spec/unit/config_spec.rb
    CHANGED
    
    | @@ -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. | 
| 4 | 
            +
              version: 6.2.3
         | 
| 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- | 
| 12 | 
            +
            date: 2023-06-18 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. | 
| 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
         |