From fe52fcd1e7733235bfd0c762ab35ea5f55882aeb Mon Sep 17 00:00:00 2001
From: "stripe-openapi[bot]"
 <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 16 Nov 2023 10:43:45 -0800
Subject: [PATCH 01/11] Update generated code for v662 (#1288)

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
---
 OPENAPI_VERSION                           | 2 +-
 lib/stripe/resources/invoice.rb           | 3 +++
 lib/stripe/resources/invoice_line_item.rb | 2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 5730a1e88..4d1efaa33 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v640
\ No newline at end of file
+v662
\ No newline at end of file
diff --git a/lib/stripe/resources/invoice.rb b/lib/stripe/resources/invoice.rb
index eb6484638..23214f731 100644
--- a/lib/stripe/resources/invoice.rb
+++ b/lib/stripe/resources/invoice.rb
@@ -40,9 +40,12 @@ class Invoice < APIResource
     extend Stripe::APIOperations::List
     extend Stripe::APIOperations::Search
     include Stripe::APIOperations::Save
+    extend Stripe::APIOperations::NestedResource
 
     OBJECT_NAME = "invoice"
 
+    nested_resource_class_methods :line, operations: %i[update]
+
     def finalize_invoice(params = {}, opts = {})
       request_stripe_object(
         method: :post,
diff --git a/lib/stripe/resources/invoice_line_item.rb b/lib/stripe/resources/invoice_line_item.rb
index 5590659bd..322190ddb 100644
--- a/lib/stripe/resources/invoice_line_item.rb
+++ b/lib/stripe/resources/invoice_line_item.rb
@@ -3,6 +3,8 @@
 
 module Stripe
   class InvoiceLineItem < StripeObject
+    include Stripe::APIOperations::Save
+
     OBJECT_NAME = "line_item"
   end
 end

From 7a81acac442d7bc1477a3efbf7ad7b5a8ec2485c Mon Sep 17 00:00:00 2001
From: "stripe-openapi[bot]"
 <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 16 Nov 2023 15:44:02 -0800
Subject: [PATCH 02/11] Update generated code for v669 (#1290)

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
---
 OPENAPI_VERSION                           | 2 +-
 lib/stripe/resources/invoice.rb           | 3 ---
 lib/stripe/resources/invoice_line_item.rb | 2 --
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 4d1efaa33..d491c2801 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v662
\ No newline at end of file
+v669
\ No newline at end of file
diff --git a/lib/stripe/resources/invoice.rb b/lib/stripe/resources/invoice.rb
index 23214f731..eb6484638 100644
--- a/lib/stripe/resources/invoice.rb
+++ b/lib/stripe/resources/invoice.rb
@@ -40,12 +40,9 @@ class Invoice < APIResource
     extend Stripe::APIOperations::List
     extend Stripe::APIOperations::Search
     include Stripe::APIOperations::Save
-    extend Stripe::APIOperations::NestedResource
 
     OBJECT_NAME = "invoice"
 
-    nested_resource_class_methods :line, operations: %i[update]
-
     def finalize_invoice(params = {}, opts = {})
       request_stripe_object(
         method: :post,
diff --git a/lib/stripe/resources/invoice_line_item.rb b/lib/stripe/resources/invoice_line_item.rb
index 322190ddb..5590659bd 100644
--- a/lib/stripe/resources/invoice_line_item.rb
+++ b/lib/stripe/resources/invoice_line_item.rb
@@ -3,8 +3,6 @@
 
 module Stripe
   class InvoiceLineItem < StripeObject
-    include Stripe::APIOperations::Save
-
     OBJECT_NAME = "line_item"
   end
 end

From 22e10313b0a4b6a032e3e14d22d49fd64a4065d8 Mon Sep 17 00:00:00 2001
From: "stripe-openapi[bot]"
 <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Tue, 21 Nov 2023 11:33:19 -0800
Subject: [PATCH 03/11] Update generated code for v670 (#1291)

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
---
 OPENAPI_VERSION               | 2 +-
 lib/stripe/resources/event.rb | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index d491c2801..189d7cacc 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v669
\ No newline at end of file
+v670
\ No newline at end of file
diff --git a/lib/stripe/resources/event.rb b/lib/stripe/resources/event.rb
index d89ed826c..0657a6904 100644
--- a/lib/stripe/resources/event.rb
+++ b/lib/stripe/resources/event.rb
@@ -23,8 +23,8 @@ module Stripe
   # `Event` objects directly to an endpoint on your server. You can manage
   # webhooks in your
   # [account settings](https://dashboard.stripe.com/account/webhooks). Learn how
-  # to [listen for events]
-  # (/docs/webhooks) so that your integration can automatically trigger reactions.
+  # to [listen for events](https://stripe.com/docs/webhooks)
+  # so that your integration can automatically trigger reactions.
   #
   # When using [Connect](https://stripe.com/docs/connect), you can also receive event notifications
   # that occur in connected accounts. For these events, there's an

From 4feded59dad8854c718b12065a33816a74a7149c Mon Sep 17 00:00:00 2001
From: Richard Marmorstein <richardm@stripe.com>
Date: Mon, 27 Nov 2023 16:50:16 -0800
Subject: [PATCH 04/11] Upgrade rubocop

---
 stripe.gemspec | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/stripe.gemspec b/stripe.gemspec
index 7d3edd5ab..b627279a9 100644
--- a/stripe.gemspec
+++ b/stripe.gemspec
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-$LOAD_PATH.unshift(::File.join(::File.dirname(__FILE__), "lib"))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
 
 require "stripe/version"
 
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
     "github_repo" => "ssh://github.com/stripe/stripe-ruby",
     "homepage_uri" => "https://stripe.com/docs/api?lang=ruby",
     "source_code_uri" => "https://github.com/stripe/stripe-ruby",
+    "rubygems_mfa_required" => "true",
   }
 
   ignored = Regexp.union(
@@ -36,6 +37,6 @@ Gem::Specification.new do |s|
   )
   s.files = `git ls-files`.split("\n").reject { |f| ignored.match(f) }
   s.executables   = `git ls-files -- bin/*`.split("\n")
-                                           .map { |f| ::File.basename(f) }
+                                           .map { |f| File.basename(f) }
   s.require_paths = ["lib"]
 end

From 7feef1dd5d630317130c65a07ae28b7c816ba9cd Mon Sep 17 00:00:00 2001
From: Richard Marmorstein <richardm@stripe.com>
Date: Mon, 27 Nov 2023 16:50:32 -0800
Subject: [PATCH 05/11] New rubocop rules

---
 .rubocop.yml | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 195 insertions(+)

diff --git a/.rubocop.yml b/.rubocop.yml
index c98f112b8..fd4e94dc2 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -70,3 +70,198 @@ Style/TrailingCommaInArrayLiteral:
 
 Style/TrailingCommaInHashLiteral:
   EnforcedStyleForMultiline: consistent_comma
+
+Gemspec/DeprecatedAttributeAssignment: # new in 1.30
+  Enabled: true
+Gemspec/DevelopmentDependencies: # new in 1.44
+  Enabled: true
+Gemspec/RequireMFA: # new in 1.23
+  Enabled: true
+Layout/LineContinuationLeadingSpace: # new in 1.31
+  Enabled: true
+Layout/LineContinuationSpacing: # new in 1.31
+  Enabled: true
+Layout/LineEndStringConcatenationIndentation: # new in 1.18
+  Enabled: true
+Layout/SpaceBeforeBrackets: # new in 1.7
+  Enabled: true
+Lint/AmbiguousAssignment: # new in 1.7
+  Enabled: true
+Lint/AmbiguousOperatorPrecedence: # new in 1.21
+  Enabled: true
+Lint/AmbiguousRange: # new in 1.19
+  Enabled: true
+Lint/ConstantOverwrittenInRescue: # new in 1.31
+  Enabled: true
+Lint/DeprecatedConstants: # new in 1.8
+  Enabled: true
+Lint/DuplicateBranch: # new in 1.3
+  Enabled: true
+Lint/DuplicateMagicComment: # new in 1.37
+  Enabled: true
+Lint/DuplicateMatchPattern: # new in 1.50
+  Enabled: true
+Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
+  Enabled: true
+Lint/EmptyBlock: # new in 1.1
+  Enabled: true
+Lint/EmptyClass: # new in 1.3
+  Enabled: true
+Lint/EmptyInPattern: # new in 1.16
+  Enabled: true
+Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
+  Enabled: true
+Lint/LambdaWithoutLiteralBlock: # new in 1.8
+  Enabled: true
+Lint/MixedCaseRange: # new in 1.53
+  Enabled: true
+Lint/NoReturnInBeginEndBlocks: # new in 1.2
+  Enabled: true
+Lint/NonAtomicFileOperation: # new in 1.31
+  Enabled: true
+Lint/NumberedParameterAssignment: # new in 1.9
+  Enabled: true
+Lint/OrAssignmentToConstant: # new in 1.9
+  Enabled: true
+Lint/RedundantDirGlobSort: # new in 1.8
+  Enabled: true
+Lint/RedundantRegexpQuantifiers: # new in 1.53
+  Enabled: true
+Lint/RefinementImportMethods: # new in 1.27
+  Enabled: true
+Lint/RequireRangeParentheses: # new in 1.32
+  Enabled: true
+Lint/RequireRelativeSelfPath: # new in 1.22
+  Enabled: true
+Lint/SymbolConversion: # new in 1.9
+  Enabled: true
+Lint/ToEnumArguments: # new in 1.1
+  Enabled: true
+Lint/TripleQuotes: # new in 1.9
+  Enabled: true
+Lint/UnexpectedBlockArity: # new in 1.5
+  Enabled: true
+Lint/UnmodifiedReduceAccumulator: # new in 1.1
+  Enabled: true
+Lint/UselessRescue: # new in 1.43
+  Enabled: true
+Lint/UselessRuby2Keywords: # new in 1.23
+  Enabled: true
+Metrics/CollectionLiteralLength: # new in 1.47
+  Enabled: true
+Naming/BlockForwarding: # new in 1.24
+  Enabled: true
+Security/CompoundHash: # new in 1.28
+  Enabled: true
+Security/IoMethods: # new in 1.22
+  Enabled: true
+Style/ArgumentsForwarding: # new in 1.1
+  Enabled: true
+Style/ArrayIntersect: # new in 1.40
+  Enabled: true
+Style/CollectionCompact: # new in 1.2
+  Enabled: true
+Style/ComparableClamp: # new in 1.44
+  Enabled: true
+Style/ConcatArrayLiterals: # new in 1.41
+  Enabled: true
+Style/DataInheritance: # new in 1.49
+  Enabled: true
+Style/DirEmpty: # new in 1.48
+  Enabled: true
+Style/DocumentDynamicEvalDefinition: # new in 1.1
+  Enabled: true
+Style/EmptyHeredoc: # new in 1.32
+  Enabled: true
+Style/EndlessMethod: # new in 1.8
+  Enabled: true
+Style/EnvHome: # new in 1.29
+  Enabled: true
+Style/ExactRegexpMatch: # new in 1.51
+  Enabled: true
+Style/FetchEnvVar: # new in 1.28
+  Enabled: true
+Style/FileEmpty: # new in 1.48
+  Enabled: true
+Style/FileRead: # new in 1.24
+  Enabled: true
+Style/FileWrite: # new in 1.24
+  Enabled: true
+Style/HashConversion: # new in 1.10
+  Enabled: true
+Style/HashExcept: # new in 1.7
+  Enabled: true
+Style/IfWithBooleanLiteralBranches: # new in 1.9
+  Enabled: true
+Style/InPatternThen: # new in 1.16
+  Enabled: true
+Style/MagicCommentFormat: # new in 1.35
+  Enabled: true
+Style/MapCompactWithConditionalBlock: # new in 1.30
+  Enabled: true
+Style/MapToHash: # new in 1.24
+  Enabled: true
+Style/MapToSet: # new in 1.42
+  Enabled: true
+Style/MinMaxComparison: # new in 1.42
+  Enabled: true
+Style/MultilineInPatternThen: # new in 1.16
+  Enabled: true
+Style/NegatedIfElseCondition: # new in 1.2
+  Enabled: true
+Style/NestedFileDirname: # new in 1.26
+  Enabled: true
+Style/NilLambda: # new in 1.3
+  Enabled: true
+Style/NumberedParameters: # new in 1.22
+  Enabled: true
+Style/NumberedParametersLimit: # new in 1.22
+  Enabled: true
+Style/ObjectThen: # new in 1.28
+  Enabled: true
+Style/OpenStructUse: # new in 1.23
+  Enabled: true
+Style/OperatorMethodCall: # new in 1.37
+  Enabled: true
+Style/QuotedSymbols: # new in 1.16
+  Enabled: true
+Style/RedundantArgument: # new in 1.4
+  Enabled: true
+Style/RedundantArrayConstructor: # new in 1.52
+  Enabled: true
+Style/RedundantConstantBase: # new in 1.40
+  Enabled: true
+Style/RedundantCurrentDirectoryInPath: # new in 1.53
+  Enabled: true
+Style/RedundantDoubleSplatHashBraces: # new in 1.41
+  Enabled: true
+Style/RedundantEach: # new in 1.38
+  Enabled: true
+Style/RedundantFilterChain: # new in 1.52
+  Enabled: true
+Style/RedundantHeredocDelimiterQuotes: # new in 1.45
+  Enabled: true
+Style/RedundantInitialize: # new in 1.27
+  Enabled: true
+Style/RedundantLineContinuation: # new in 1.49
+  Enabled: true
+Style/RedundantRegexpArgument: # new in 1.53
+  Enabled: true
+Style/RedundantRegexpConstructor: # new in 1.52
+  Enabled: true
+Style/RedundantSelfAssignmentBranch: # new in 1.19
+  Enabled: true
+Style/RedundantStringEscape: # new in 1.37
+  Enabled: true
+Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
+  Enabled: true
+Style/SelectByRegexp: # new in 1.22
+  Enabled: true
+Style/SingleLineDoEndBlock: # new in 1.57
+  Enabled: true
+Style/StringChars: # new in 1.12
+  Enabled: true
+Style/SwapValues: # new in 1.1
+  Enabled: true
+Style/YAMLFileRead: # new in 1.53
+  Enabled: true

From 633ca27ae7673486506f73a470179902025a3528 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein <richardm@stripe.com>
Date: Mon, 27 Nov 2023 16:50:55 -0800
Subject: [PATCH 06/11] Upgrade rubocop

---
 Gemfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Gemfile b/Gemfile
index cbb5d797d..d9ff531b1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,7 +23,7 @@ group :development do
   # `Gemfile.lock` checked in, so to prevent good builds from suddenly going
   # bad, pin to a specific version number here. Try to keep this relatively
   # up-to-date, but it's not the end of the world if it's not.
-  gem "rubocop", "0.80"
+  gem "rubocop", "1.57.2"
 
   # jaro_winkler 1.5.5 installation fails for jruby
   gem "jaro_winkler", "1.5.4"

From 2d6249fbd25038e9862f00b0cb8d358edcf785a0 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein <richardm@stripe.com>
Date: Mon, 27 Nov 2023 17:02:33 -0800
Subject: [PATCH 07/11] Autocorrect

---
 .rubocop_todo.yml                             | 76 ++++++++++++++++---
 Rakefile                                      |  6 +-
 bin/stripe-console                            |  2 +-
 lib/stripe/api_operations/request.rb          |  8 +-
 lib/stripe/api_operations/save.rb             | 12 ++-
 lib/stripe/api_resource_test_helpers.rb       |  4 +-
 lib/stripe/connection_manager.rb              | 10 +--
 lib/stripe/errors.rb                          | 14 +---
 lib/stripe/instrumentation.rb                 | 26 ++-----
 lib/stripe/multipart_encoder.rb               | 14 ++--
 lib/stripe/oauth.rb                           | 12 +--
 lib/stripe/resources/account.rb               | 16 ++--
 lib/stripe/resources/alipay_account.rb        |  2 +-
 .../resources/application_fee_refund.rb       |  2 +-
 lib/stripe/resources/bank_account.rb          |  4 +-
 lib/stripe/resources/capability.rb            |  2 +-
 lib/stripe/resources/file.rb                  |  6 +-
 lib/stripe/resources/reversal.rb              |  2 +-
 lib/stripe/resources/tax_id.rb                |  2 +-
 lib/stripe/stripe_client.rb                   | 67 ++++++----------
 lib/stripe/stripe_configuration.rb            | 42 ++++------
 lib/stripe/stripe_object.rb                   | 33 ++++----
 lib/stripe/stripe_response.rb                 |  4 +-
 lib/stripe/util.rb                            | 22 +++---
 test/stripe/account_link_test.rb              |  2 +-
 test/stripe/account_test.rb                   |  5 +-
 test/stripe/api_operations_test.rb            |  4 +-
 test/stripe/api_resource_test.rb              | 10 +--
 test/stripe/apple_pay_domain_test.rb          |  4 +-
 test/stripe/application_fee_refund_test.rb    |  2 +-
 test/stripe/application_fee_test.rb           |  2 +-
 test/stripe/balance_test.rb                   |  2 +-
 test/stripe/balance_transaction_test.rb       |  2 +-
 test/stripe/bank_account_test.rb              |  2 +-
 .../billing_portal/configuration_test.rb      |  2 +-
 test/stripe/billing_portal/session_test.rb    |  2 +-
 test/stripe/capability_test.rb                |  2 +-
 test/stripe/charge_test.rb                    |  2 +-
 test/stripe/checkout/session_test.rb          |  2 +-
 test/stripe/connection_manager_test.rb        |  2 +-
 test/stripe/country_spec_test.rb              |  2 +-
 test/stripe/coupon_test.rb                    |  2 +-
 test/stripe/credit_note_test.rb               |  2 +-
 .../customer_balance_transaction_test.rb      |  2 +-
 test/stripe/customer_card_test.rb             |  2 +-
 test/stripe/customer_test.rb                  |  2 +-
 test/stripe/dispute_test.rb                   |  2 +-
 test/stripe/ephemeral_key_test.rb             |  2 +-
 test/stripe/errors_test.rb                    |  2 +-
 test/stripe/exchange_rate_test.rb             |  2 +-
 test/stripe/file_link_test.rb                 |  2 +-
 test/stripe/file_test.rb                      |  2 +-
 test/stripe/generated_examples_test.rb        |  2 +-
 .../identity/verification_report_test.rb      |  2 +-
 .../identity/verification_session_test.rb     |  2 +-
 test/stripe/invoice_item_test.rb              |  2 +-
 test/stripe/invoice_line_item_test.rb         |  2 +-
 test/stripe/invoice_test.rb                   |  2 +-
 test/stripe/issuing/authorization_test.rb     |  2 +-
 test/stripe/issuing/card_test.rb              |  2 +-
 test/stripe/issuing/cardholder_test.rb        |  2 +-
 test/stripe/issuing/dispute_test.rb           |  2 +-
 test/stripe/issuing/transaction_test.rb       |  2 +-
 test/stripe/list_object_test.rb               |  2 +-
 test/stripe/login_link_test.rb                |  2 +-
 test/stripe/mandate_test.rb                   |  2 +-
 test/stripe/multipart_encoder_test.rb         |  2 +-
 test/stripe/oauth_test.rb                     |  4 +-
 test/stripe/payment_intent_test.rb            |  2 +-
 test/stripe/payment_method_test.rb            |  2 +-
 test/stripe/payout_test.rb                    |  2 +-
 test/stripe/person_test.rb                    |  2 +-
 test/stripe/plan_test.rb                      |  2 +-
 test/stripe/price_test.rb                     |  2 +-
 test/stripe/product_test.rb                   |  2 +-
 test/stripe/promotion_code_test.rb            |  2 +-
 test/stripe/quote_test.rb                     |  4 +-
 test/stripe/radar/early_fraud_warning_test.rb |  2 +-
 test/stripe/radar/value_list_item_test.rb     |  2 +-
 test/stripe/radar/value_list_test.rb          |  2 +-
 test/stripe/refund_test.rb                    |  2 +-
 test/stripe/reporting/report_run_test.rb      |  2 +-
 test/stripe/reporting/report_type_test.rb     |  2 +-
 test/stripe/reversal_test.rb                  |  2 +-
 test/stripe/review_test.rb                    |  2 +-
 test/stripe/search_result_object_test.rb      |  4 +-
 test/stripe/setup_attempt_test.rb             |  2 +-
 test/stripe/setup_intent_test.rb              |  2 +-
 test/stripe/sigma/scheduled_query_run_test.rb |  2 +-
 test/stripe/source_test.rb                    |  2 +-
 test/stripe/stripe_client_test.rb             | 20 +++--
 test/stripe/stripe_configuration_test.rb      |  2 +-
 test/stripe/stripe_object_test.rb             | 12 +--
 test/stripe/stripe_response_test.rb           |  2 +-
 test/stripe/subscription_item_test.rb         |  2 +-
 test/stripe/subscription_schedule_test.rb     |  2 +-
 test/stripe/subscription_test.rb              |  2 +-
 test/stripe/tax_code_test.rb                  |  2 +-
 test/stripe/tax_id_test.rb                    |  2 +-
 test/stripe/tax_rate_test.rb                  |  2 +-
 test/stripe/terminal/connection_token_test.rb |  2 +-
 test/stripe/terminal/location_test.rb         |  2 +-
 test/stripe/terminal/reader_test.rb           |  2 +-
 test/stripe/topup_test.rb                     |  2 +-
 test/stripe/transfer_test.rb                  |  2 +-
 test/stripe/usage_record_summary_test.rb      |  2 +-
 test/stripe/util_test.rb                      |  4 +-
 test/stripe/webhook_endpoint_test.rb          |  2 +-
 test/stripe/webhook_test.rb                   |  2 +-
 test/stripe_test.rb                           |  2 +-
 test/test_helper.rb                           | 14 ++--
 111 files changed, 300 insertions(+), 325 deletions(-)

diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 008fd20de..e2d4f62b1 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,33 +1,87 @@
 # This configuration was generated by
 # `rubocop --auto-gen-config`
-# on 2019-07-30 09:56:31 +0800 using RuboCop version 0.73.0.
+# on 2023-11-28 01:02:03 UTC using RuboCop version 1.57.2.
 # The point is for the user to remove these configuration records
 # one by one as the offenses are removed from the code base.
 # Note that changes in the inspected code, or installation of new
 # versions of RuboCop, may require this file to be generated again.
 
-# Offense count: 23
+# Offense count: 2
+Lint/HashCompareByIdentity:
+  Exclude:
+    - 'lib/stripe/stripe_client.rb'
+
+# Offense count: 26
+# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
 Metrics/AbcSize:
-  Max: 51
+  Max: 50
 
-# Offense count: 12
-# Configuration parameters: CountComments.
+# Offense count: 9
+# Configuration parameters: CountComments, CountAsOne.
 Metrics/ClassLength:
-  Max: 694
+  Max: 592
 
 # Offense count: 12
+# Configuration parameters: AllowedMethods, AllowedPatterns.
 Metrics/CyclomaticComplexity:
-  Max: 15
+  Max: 12
 
-# Offense count: 6
-# Configuration parameters: CountKeywordArgs.
+# Offense count: 9
+# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
 Metrics/ParameterLists:
   Max: 7
 
 # Offense count: 8
+# Configuration parameters: AllowedMethods, AllowedPatterns.
 Metrics/PerceivedComplexity:
-  Max: 17
+  Max: 12
+
+# Offense count: 1
+# This cop supports unsafe autocorrection (--autocorrect-all).
+# Configuration parameters: MinBranchesCount.
+Style/CaseLikeIf:
+  Exclude:
+    - 'lib/stripe/stripe_configuration.rb'
+
+# Offense count: 1
+# This cop supports unsafe autocorrection (--autocorrect-all).
+Style/CombinableLoops:
+  Exclude:
+    - 'lib/stripe/stripe_client.rb'
 
-# Offense count: 86
+# Offense count: 39
+# Configuration parameters: AllowedConstants.
 Style/Documentation:
   Enabled: false
+
+# Offense count: 1
+# This cop supports unsafe autocorrection (--autocorrect-all).
+# Configuration parameters: AllowSplatArgument.
+Style/HashConversion:
+  Exclude:
+    - 'lib/stripe/stripe_client.rb'
+
+# Offense count: 3
+# This cop supports unsafe autocorrection (--autocorrect-all).
+# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
+# AllowedMethods: present?, blank?, presence, try, try!
+Style/SafeNavigation:
+  Exclude:
+    - 'lib/stripe/instrumentation.rb'
+    - 'lib/stripe/stripe_response.rb'
+
+# Offense count: 15
+# This cop supports unsafe autocorrection (--autocorrect-all).
+# Configuration parameters: Mode.
+Style/StringConcatenation:
+  Exclude:
+    - 'lib/stripe.rb'
+    - 'lib/stripe/connection_manager.rb'
+    - 'lib/stripe/multipart_encoder.rb'
+    - 'lib/stripe/oauth.rb'
+    - 'lib/stripe/resources/bank_account.rb'
+    - 'lib/stripe/resources/source.rb'
+    - 'lib/stripe/stripe_client.rb'
+    - 'test/stripe/api_resource_test.rb'
+    - 'test/stripe/stripe_client_test.rb'
+    - 'test/stripe/webhook_test.rb'
diff --git a/Rakefile b/Rakefile
index 4b3c61cfa..9e928e3bc 100644
--- a/Rakefile
+++ b/Rakefile
@@ -17,7 +17,7 @@ task :update_certs do
   require "uri"
 
   fetch_file "https://curl.haxx.se/ca/cacert.pem",
-             ::File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
+             File.expand_path("lib/data/ca-certificates.crt", __dir__)
 end
 
 #
@@ -25,11 +25,11 @@ end
 #
 
 def fetch_file(uri, dest)
-  ::File.open(dest, "w") do |file|
+  File.open(dest, "w") do |file|
     resp = Net::HTTP.get_response(URI.parse(uri))
     unless resp.code.to_i == 200
       abort("bad response when fetching: #{uri}\n" \
-        "Status #{resp.code}: #{resp.body}")
+            "Status #{resp.code}: #{resp.body}")
     end
     file.write(resp.body)
     puts "Successfully fetched: #{uri}"
diff --git a/bin/stripe-console b/bin/stripe-console
index f3262bce0..ecf27d2f2 100755
--- a/bin/stripe-console
+++ b/bin/stripe-console
@@ -5,7 +5,7 @@
 require "irb"
 require "irb/completion"
 
-require "#{::File.dirname(__FILE__)}/../lib/stripe"
+require "#{File.dirname(__FILE__)}/../lib/stripe"
 
 # Config IRB to enable --simple-prompt and auto indent
 IRB.conf[:PROMPT_MODE] = :SIMPLE
diff --git a/lib/stripe/api_operations/request.rb b/lib/stripe/api_operations/request.rb
index 8544dedd6..0d237b840 100644
--- a/lib/stripe/api_operations/request.rb
+++ b/lib/stripe/api_operations/request.rb
@@ -87,7 +87,7 @@ def execute_resource_request_stream(method, url,
 
             raise ArgumentError,
                   "request option '#{opt}' should be a string value " \
-                    "(was a #{val.class})"
+                  "(was a #{val.class})"
           end
         end
 
@@ -96,14 +96,12 @@ def execute_resource_request_stream(method, url,
 
           raise ArgumentError,
                 "request params should be either a Hash or nil " \
-                  "(was a #{params.class})"
+                "(was a #{params.class})"
         end
 
         private def warn_on_opts_in_params(params)
           Util::OPTS_USER_SPECIFIED.each do |opt|
-            if params.key?(opt)
-              warn("WARNING: '#{opt}' should be in opts instead of params.")
-            end
+            warn("WARNING: '#{opt}' should be in opts instead of params.") if params.key?(opt)
           end
         end
       end
diff --git a/lib/stripe/api_operations/save.rb b/lib/stripe/api_operations/save.rb
index 1e1d252fe..7dbca861a 100644
--- a/lib/stripe/api_operations/save.rb
+++ b/lib/stripe/api_operations/save.rb
@@ -19,9 +19,7 @@ module ClassMethods
         #   {APIOperations::Request.execute_resource_request}.
         def update(id, params = {}, opts = {})
           params.each_key do |k|
-            if protected_fields.include?(k)
-              raise ArgumentError, "Cannot update protected field: #{k}"
-            end
+            raise ArgumentError, "Cannot update protected field: #{k}" if protected_fields.include?(k)
           end
 
           request_stripe_object(
@@ -64,7 +62,7 @@ def save(params = {}, opts = {})
 
         values = serialize_params(self).merge(params)
 
-        # note that id gets removed here our call to #url above has already
+        # NOTE: that id gets removed here our call to #url above has already
         # generated a uri for this object with an identifier baked in
         values.delete(:id)
 
@@ -72,9 +70,9 @@ def save(params = {}, opts = {})
         initialize_from(resp.data, opts)
       end
       extend Gem::Deprecate
-      deprecate :save, "the `update` class method (for examples"\
-                " see https://github.com/stripe/stripe-ruby"\
-                "/wiki/Migration-guide-for-v8)", 2022, 11
+      deprecate :save, "the `update` class method (for examples " \
+                       "see https://github.com/stripe/stripe-ruby" \
+                       "/wiki/Migration-guide-for-v8)", 2022, 11
 
       def self.included(base)
         # Set `metadata` as additive so that when it's set directly we remember
diff --git a/lib/stripe/api_resource_test_helpers.rb b/lib/stripe/api_resource_test_helpers.rb
index 2309cd592..28bdcee7b 100644
--- a/lib/stripe/api_resource_test_helpers.rb
+++ b/lib/stripe/api_resource_test_helpers.rb
@@ -31,8 +31,8 @@ def self.custom_method(name, http_verb:, http_path: nil)
     end
 
     def self.resource_url
-      "/v1/test_helpers/"\
-      "#{self::RESOURCE_CLASS::OBJECT_NAME.downcase.tr('.', '/')}s"
+      "/v1/test_helpers/" \
+        "#{self::RESOURCE_CLASS::OBJECT_NAME.downcase.tr('.', '/')}s"
     end
 
     def resource_url
diff --git a/lib/stripe/connection_manager.rb b/lib/stripe/connection_manager.rb
index af8b25f83..0c0dd23a7 100644
--- a/lib/stripe/connection_manager.rb
+++ b/lib/stripe/connection_manager.rb
@@ -157,9 +157,7 @@ def execute_request(method, uri, body: nil, headers: nil, query: nil,
 
       connection.open_timeout = config.open_timeout
       connection.read_timeout = config.read_timeout
-      if connection.respond_to?(:write_timeout=)
-        connection.write_timeout = config.write_timeout
-      end
+      connection.write_timeout = config.write_timeout if connection.respond_to?(:write_timeout=)
 
       connection.use_ssl = uri.scheme == "https"
 
@@ -192,9 +190,9 @@ def execute_request(method, uri, body: nil, headers: nil, query: nil,
 
       @verify_ssl_warned = true
       warn("WARNING: Running without SSL cert verification. " \
-        "You should never do this in production. " \
-        "Execute `Stripe.verify_ssl_certs = true` to enable " \
-        "verification.")
+           "You should never do this in production. " \
+           "Execute `Stripe.verify_ssl_certs = true` to enable " \
+           "verification.")
     end
   end
 end
diff --git a/lib/stripe/errors.rb b/lib/stripe/errors.rb
index 6397acf05..3945e1468 100644
--- a/lib/stripe/errors.rb
+++ b/lib/stripe/errors.rb
@@ -4,22 +4,14 @@ module Stripe
   # StripeError is the base error from which all other more specific Stripe
   # errors derive.
   class StripeError < StandardError
-    attr_reader :message
+    attr_reader :message, :code, :error, :http_body, :http_headers, :http_status, :json_body, :request_id
 
     # Response contains a StripeResponse object that has some basic information
     # about the response that conveyed the error.
-    attr_accessor :response
-
-    attr_reader :code
-    attr_reader :error
-    attr_reader :http_body
-    attr_reader :http_headers
-    attr_reader :http_status
-    attr_reader :json_body # equivalent to #data
-    attr_reader :request_id
+    attr_accessor :response # equivalent to #data
 
     # Initializes a StripeError.
-    def initialize(message = nil, http_status: nil, http_body: nil,
+    def initialize(message = nil, http_status: nil, http_body: nil, # rubocop:todo Lint/MissingSuper
                    json_body: nil, http_headers: nil, code: nil)
       @message = message
       @http_status = http_status
diff --git a/lib/stripe/instrumentation.rb b/lib/stripe/instrumentation.rb
index a30e4c776..25835540c 100644
--- a/lib/stripe/instrumentation.rb
+++ b/lib/stripe/instrumentation.rb
@@ -4,8 +4,7 @@ module Stripe
   class Instrumentation
     # Event emitted on `request_begin` callback.
     class RequestBeginEvent
-      attr_reader :method
-      attr_reader :path
+      attr_reader :method, :path
 
       # Arbitrary user-provided data in the form of a Ruby hash that's passed
       # from subscribers on `request_begin` to subscribers on `request_end`.
@@ -27,16 +26,8 @@ def initialize(method:, path:, user_data:)
 
     # Event emitted on `request_end` callback.
     class RequestEndEvent
-      attr_reader :duration
-      attr_reader :http_status
-      attr_reader :method
-      attr_reader :num_retries
-      attr_reader :path
-      attr_reader :request_id
-      attr_reader :response_header
-      attr_reader :response_body
-      attr_reader :request_header
-      attr_reader :request_body
+      attr_reader :duration, :http_status, :method, :num_retries, :path, :request_id, :response_header, :response_body,
+                  :request_header, :request_body
 
       # Arbitrary user-provided data in the form of a Ruby hash that's passed
       # from subscribers on `request_begin` to subscribers on `request_end`.
@@ -62,12 +53,7 @@ def initialize(request_context:, response_context:,
     end
 
     class RequestContext
-      attr_reader :duration
-      attr_reader :method
-      attr_reader :path
-      attr_reader :request_id
-      attr_reader :body
-      attr_reader :header
+      attr_reader :duration, :method, :path, :request_id, :body, :header
 
       def initialize(duration:, context:, header:)
         @duration = duration
@@ -80,9 +66,7 @@ def initialize(duration:, context:, header:)
     end
 
     class ResponseContext
-      attr_reader :http_status
-      attr_reader :body
-      attr_reader :header
+      attr_reader :http_status, :body, :header
 
       def initialize(http_status:, response:)
         @http_status = http_status
diff --git a/lib/stripe/multipart_encoder.rb b/lib/stripe/multipart_encoder.rb
index 0df93460d..a3a036dfa 100644
--- a/lib/stripe/multipart_encoder.rb
+++ b/lib/stripe/multipart_encoder.rb
@@ -106,22 +106,22 @@ def encode(params)
     end
 
     private def write_field(name, data, filename:)
-      if !@first_field
-        @body << "\r\n"
-      else
+      if @first_field
         @first_field = false
+      else
+        @body << "\r\n"
       end
 
       @body << "--#{@boundary}\r\n"
 
       if filename
-        @body << %(Content-Disposition: form-data) +
+        @body << (%(Content-Disposition: form-data) +
                  %(; name="#{escape(name.to_s)}") +
-                 %(; filename="#{escape(filename)}"\r\n)
+                 %(; filename="#{escape(filename)}"\r\n))
         @body << %(Content-Type: application/octet-stream\r\n)
       else
-        @body << %(Content-Disposition: form-data) +
-                 %(; name="#{escape(name.to_s)}"\r\n)
+        @body << (%(Content-Disposition: form-data) +
+                 %(; name="#{escape(name.to_s)}"\r\n))
       end
 
       @body << "\r\n"
diff --git a/lib/stripe/oauth.rb b/lib/stripe/oauth.rb
index 580b424c8..0ac1d8561 100644
--- a/lib/stripe/oauth.rb
+++ b/lib/stripe/oauth.rb
@@ -18,12 +18,12 @@ def self.get_client_id(params = {})
       client_id = params[:client_id] || Stripe.client_id
       unless client_id
         raise AuthenticationError, "No client_id provided. " \
-          'Set your client_id using "Stripe.client_id = <CLIENT-ID>". ' \
-          "You can find your client_ids in your Stripe dashboard at " \
-          "https://dashboard.stripe.com/account/applications/settings, " \
-          "after registering your account as a platform. See " \
-          "https://stripe.com/docs/connect/standalone-accounts for details, " \
-          "or email support@stripe.com if you have any questions."
+                                   'Set your client_id using "Stripe.client_id = <CLIENT-ID>". ' \
+                                   "You can find your client_ids in your Stripe dashboard at " \
+                                   "https://dashboard.stripe.com/account/applications/settings, " \
+                                   "after registering your account as a platform. See " \
+                                   "https://stripe.com/docs/connect/standalone-accounts for details, " \
+                                   "or email support@stripe.com if you have any questions."
       end
       client_id
     end
diff --git a/lib/stripe/resources/account.rb b/lib/stripe/resources/account.rb
index 88811d67b..135ebd87e 100644
--- a/lib/stripe/resources/account.rb
+++ b/lib/stripe/resources/account.rb
@@ -123,17 +123,13 @@ def serialize_params(options = {})
     end
 
     def serialize_params_account(_obj, update_hash, options = {})
-      if (entity = @values[:legal_entity])
-        if (owners = entity[:additional_owners])
-          entity_update = update_hash[:legal_entity] ||= {}
-          entity_update[:additional_owners] =
-            serialize_additional_owners(entity, owners)
-        end
+      if (entity = @values[:legal_entity]) && (owners = entity[:additional_owners])
+        entity_update = update_hash[:legal_entity] ||= {}
+        entity_update[:additional_owners] =
+          serialize_additional_owners(entity, owners)
       end
-      if (individual = @values[:individual])
-        if individual.is_a?(Person) && !update_hash.key?(:individual)
-          update_hash[:individual] = individual.serialize_params(options)
-        end
+      if (individual = @values[:individual]) && (individual.is_a?(Person) && !update_hash.key?(:individual))
+        update_hash[:individual] = individual.serialize_params(options)
       end
       update_hash
     end
diff --git a/lib/stripe/resources/alipay_account.rb b/lib/stripe/resources/alipay_account.rb
index 785c184cf..22b3588aa 100644
--- a/lib/stripe/resources/alipay_account.rb
+++ b/lib/stripe/resources/alipay_account.rb
@@ -14,7 +14,7 @@ def resource_url
       end
 
       "#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
-      "/#{CGI.escape(id)}"
+        "/#{CGI.escape(id)}"
     end
 
     def self.update(_id, _params = nil, _opts = nil)
diff --git a/lib/stripe/resources/application_fee_refund.rb b/lib/stripe/resources/application_fee_refund.rb
index f2052d8be..635494d43 100644
--- a/lib/stripe/resources/application_fee_refund.rb
+++ b/lib/stripe/resources/application_fee_refund.rb
@@ -15,7 +15,7 @@ class ApplicationFeeRefund < APIResource
 
     def resource_url
       "#{ApplicationFee.resource_url}/#{CGI.escape(fee)}/refunds" \
-      "/#{CGI.escape(id)}"
+        "/#{CGI.escape(id)}"
     end
 
     def self.update(_id, _params = nil, _opts = nil)
diff --git a/lib/stripe/resources/bank_account.rb b/lib/stripe/resources/bank_account.rb
index db9431490..75feba122 100644
--- a/lib/stripe/resources/bank_account.rb
+++ b/lib/stripe/resources/bank_account.rb
@@ -31,8 +31,8 @@ def resource_url
 
     def self.update(_id, _params = nil, _opts = nil)
       raise NotImplementedError,
-            "Bank accounts cannot be updated without a customer ID or an " \
-            " account ID. Update a bank account using " \
+            "Bank accounts cannot be updated without a customer ID or an  " \
+            "account ID. Update a bank account using " \
             "`Customer.update_source('customer_id', 'bank_account_id', " \
             "update_params)` or `Account.update_external_account(" \
             "'account_id', 'bank_account_id', update_params)`"
diff --git a/lib/stripe/resources/capability.rb b/lib/stripe/resources/capability.rb
index 17835b08a..cf65c1c66 100644
--- a/lib/stripe/resources/capability.rb
+++ b/lib/stripe/resources/capability.rb
@@ -17,7 +17,7 @@ def resource_url
               "Capabilities cannot be accessed without an account ID."
       end
       "#{Account.resource_url}/#{CGI.escape(account)}/capabilities" \
-      "/#{CGI.escape(id)}"
+        "/#{CGI.escape(id)}"
     end
 
     def self.retrieve(_id, _opts = {})
diff --git a/lib/stripe/resources/file.rb b/lib/stripe/resources/file.rb
index cfc2572a3..c389adf4a 100644
--- a/lib/stripe/resources/file.rb
+++ b/lib/stripe/resources/file.rb
@@ -26,10 +26,8 @@ def self.resource_url
     end
 
     def self.create(params = {}, opts = {})
-      if params[:file] && !params[:file].is_a?(String)
-        unless params[:file].respond_to?(:read)
-          raise ArgumentError, "file must respond to `#read`"
-        end
+      if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
+        raise ArgumentError, "file must respond to `#read`"
       end
 
       config = opts[:client]&.config || Stripe.config
diff --git a/lib/stripe/resources/reversal.rb b/lib/stripe/resources/reversal.rb
index e459a2466..db67f1c92 100644
--- a/lib/stripe/resources/reversal.rb
+++ b/lib/stripe/resources/reversal.rb
@@ -23,7 +23,7 @@ class Reversal < APIResource
 
     def resource_url
       "#{Transfer.resource_url}/#{CGI.escape(transfer)}/reversals" \
-      "/#{CGI.escape(id)}"
+        "/#{CGI.escape(id)}"
     end
 
     def self.update(_id, _params = nil, _opts = nil)
diff --git a/lib/stripe/resources/tax_id.rb b/lib/stripe/resources/tax_id.rb
index 07fecfebb..d81d3e9b9 100644
--- a/lib/stripe/resources/tax_id.rb
+++ b/lib/stripe/resources/tax_id.rb
@@ -18,7 +18,7 @@ def resource_url
               "Tax IDs cannot be accessed without a customer ID."
       end
       "#{Customer.resource_url}/#{CGI.escape(customer)}/tax_ids" \
-      "/#{CGI.escape(id)}"
+        "/#{CGI.escape(id)}"
     end
 
     def self.retrieve(_id, _opts = {})
diff --git a/lib/stripe/stripe_client.rb b/lib/stripe/stripe_client.rb
index 54f06c4c8..6bb05815f 100644
--- a/lib/stripe/stripe_client.rb
+++ b/lib/stripe/stripe_client.rb
@@ -36,8 +36,7 @@ def initialize(config_arg = {})
                 end
     end
 
-    attr_reader :config
-    attr_reader :options
+    attr_reader :config, :options
 
     # Gets a currently active `StripeClient`. Set for the current thread when
     # `StripeClient#request` is being run so that API operations being executed
@@ -80,9 +79,7 @@ def self.clear_all_connection_managers(config: nil)
             end
           end
 
-          if thread_context.default_connection_managers.empty?
-            pruned_contexts << thread_context
-          end
+          pruned_contexts << thread_context if thread_context.default_connection_managers.empty?
         end
 
         @thread_contexts_with_connection_managers.subtract(pruned_contexts)
@@ -120,7 +117,7 @@ def self.should_retry?(error,
       when Net::OpenTimeout, Net::ReadTimeout
         # Retry on timeout-related problems (either on open or read).
         true
-      when EOFError, Errno::ECONNREFUSED, Errno::ECONNRESET,
+      when EOFError, Errno::ECONNREFUSED, Errno::ECONNRESET, # rubocop:todo Lint/DuplicateBranch
             Errno::EHOSTUNREACH, Errno::ETIMEDOUT, SocketError
         # Destination refused the connection, the connection was reset, or a
         # variety of other connection failures. This could occur from a single
@@ -287,21 +284,21 @@ def last_response_has_key?(object_id)
 
     ERROR_MESSAGE_CONNECTION =
       "Unexpected error communicating when trying to connect to " \
-        "Stripe (%s). You may be seeing this message because your DNS is not " \
-        "working or you don't have an internet connection.  To check, try " \
-        "running `host stripe.com` from the command line."
+      "Stripe (%s). You may be seeing this message because your DNS is not " \
+      "working or you don't have an internet connection.  To check, try " \
+      "running `host stripe.com` from the command line."
     ERROR_MESSAGE_SSL =
       "Could not establish a secure connection to Stripe (%s), you " \
-        "may need to upgrade your OpenSSL version. To check, try running " \
-        "`openssl s_client -connect api.stripe.com:443` from the command " \
-        "line."
+      "may need to upgrade your OpenSSL version. To check, try running " \
+      "`openssl s_client -connect api.stripe.com:443` from the command " \
+      "line."
 
     # Common error suffix sared by both connect and read timeout messages.
     ERROR_MESSAGE_TIMEOUT_SUFFIX =
       "Please check your internet connection and try again. " \
-        "If this problem persists, you should check Stripe's service " \
-        "status at https://status.stripe.com, or let us know at " \
-        "support@stripe.com."
+      "If this problem persists, you should check Stripe's service " \
+      "status at https://status.stripe.com, or let us know at " \
+      "support@stripe.com."
 
     ERROR_MESSAGE_TIMEOUT_CONNECT = (
       "Timed out connecting to Stripe (%s). " +
@@ -488,9 +485,7 @@ def self.maybe_gc_connection_managers
       response_block =
         if block_given?
           lambda do |response|
-            unless should_handle_as_error(response.code.to_i)
-              response.read_body(&read_body_chunk_block)
-            end
+            response.read_body(&read_body_chunk_block) unless should_handle_as_error(response.code.to_i)
           end
         end
 
@@ -515,18 +510,18 @@ def self.maybe_gc_connection_managers
     private def check_api_key!(api_key)
       unless api_key
         raise AuthenticationError, "No API key provided. " \
-          'Set your API key using "Stripe.api_key = <API-KEY>". ' \
-          "You can generate API keys from the Stripe web interface. " \
-          "See https://stripe.com/api for details, or email " \
-          "support@stripe.com if you have any questions."
+                                   'Set your API key using "Stripe.api_key = <API-KEY>". ' \
+                                   "You can generate API keys from the Stripe web interface. " \
+                                   "See https://stripe.com/api for details, or email " \
+                                   "support@stripe.com if you have any questions."
       end
 
       return unless api_key =~ /\s/
 
       raise AuthenticationError, "Your API key is invalid, as it contains " \
-        "whitespace. (HINT: You can double-check your API key from the " \
-        "Stripe web interface. See https://stripe.com/api for details, or " \
-        "email support@stripe.com if you have any questions.)"
+                                 "whitespace. (HINT: You can double-check your API key from the " \
+                                 "Stripe web interface. See https://stripe.com/api for details, or " \
+                                 "email support@stripe.com if you have any questions.)"
     end
 
     # Encodes a set of body parameters using multipart if `Content-Type` is set
@@ -582,9 +577,7 @@ def self.maybe_gc_connection_managers
         http_status = resp.code.to_i
         context = context.dup_from_response_headers(resp)
 
-        if should_handle_as_error(http_status)
-          handle_error_response(resp, context)
-        end
+        handle_error_response(resp, context) if should_handle_as_error(http_status)
 
         log_response(context, request_start, http_status, resp.body, resp)
         notify_request_end(context, request_duration, http_status,
@@ -634,7 +627,7 @@ def self.maybe_gc_connection_managers
 
         # Only handle errors when we know we can do so, and re-raise otherwise.
         # This should be pretty infrequent.
-        else
+        else # rubocop:todo Lint/DuplicateBranch
           raise
         end
       end
@@ -844,7 +837,7 @@ def self.maybe_gc_connection_managers
 
       if errors.nil?
         message = "Unexpected error #{error.class.name} communicating " \
-          "with Stripe. Please let us know at support@stripe.com."
+                  "with Stripe. Please let us know at support@stripe.com."
       end
 
       api_base ||= config.api_base
@@ -858,9 +851,7 @@ def self.maybe_gc_connection_managers
 
     private def request_headers(api_key, method)
       user_agent = "Stripe/v1 RubyBindings/#{Stripe::VERSION}"
-      unless Stripe.app_info.nil?
-        user_agent += " " + format_app_info(Stripe.app_info)
-      end
+      user_agent += " " + format_app_info(Stripe.app_info) unless Stripe.app_info.nil?
 
       headers = {
         "User-Agent" => user_agent,
@@ -963,15 +954,7 @@ def self.maybe_gc_connection_managers
     # that we can log certain information. It's useful because it means that we
     # don't have to pass around as many parameters.
     class RequestLogContext
-      attr_accessor :body
-      attr_accessor :account
-      attr_accessor :api_key
-      attr_accessor :api_version
-      attr_accessor :idempotency_key
-      attr_accessor :method
-      attr_accessor :path
-      attr_accessor :query
-      attr_accessor :request_id
+      attr_accessor :body, :account, :api_key, :api_version, :idempotency_key, :method, :path, :query, :request_id
 
       # The idea with this method is that we might want to update some of
       # context information because a response that we've received from the API
diff --git a/lib/stripe/stripe_configuration.rb b/lib/stripe/stripe_configuration.rb
index f58bd7209..6b8e5f19b 100644
--- a/lib/stripe/stripe_configuration.rb
+++ b/lib/stripe/stripe_configuration.rb
@@ -25,26 +25,12 @@ module Stripe
   # If `.logger` is set, the value of `.log_level` is ignored. The decision on
   # what levels to print is entirely deferred to the logger.
   class StripeConfiguration
-    attr_accessor :api_key
-    attr_accessor :api_version
-    attr_accessor :client_id
-    attr_accessor :enable_telemetry
-    attr_accessor :logger
-    attr_accessor :stripe_account
-
-    attr_reader :api_base
-    attr_reader :uploads_base
-    attr_reader :connect_base
-    attr_reader :ca_bundle_path
-    attr_reader :log_level
-    attr_reader :initial_network_retry_delay
-    attr_reader :max_network_retries
-    attr_reader :max_network_retry_delay
-    attr_reader :open_timeout
-    attr_reader :read_timeout
-    attr_reader :write_timeout
-    attr_reader :proxy
-    attr_reader :verify_ssl_certs
+    attr_accessor :api_key, :api_version, :client_id, :enable_telemetry, :logger, :stripe_account
+
+    attr_reader :api_base, :uploads_base, :connect_base, :ca_bundle_path, :log_level, :initial_network_retry_delay,
+                # rubocop:todo Layout/LineLength
+                :max_network_retries, :max_network_retry_delay, :open_timeout, :read_timeout, :write_timeout, :proxy, :verify_ssl_certs
+    # rubocop:enable Layout/LineLength
 
     def self.setup
       new.tap do |instance|
@@ -95,8 +81,8 @@ def log_level=(val)
 
       if !val.nil? && !levels.include?(val)
         raise ArgumentError,
-              "log_level should only be set to `nil`, `debug`, `info`," \
-              " or `error`"
+              "log_level should only be set to `nil`, `debug`, `info`, " \
+              "or `error`"
       end
       @log_level = val
     end
@@ -124,9 +110,7 @@ def read_timeout=(read_timeout)
     end
 
     def write_timeout=(write_timeout)
-      unless Net::HTTP.instance_methods.include?(:write_timeout=)
-        raise NotImplementedError
-      end
+      raise NotImplementedError unless Net::HTTP.instance_methods.include?(:write_timeout=)
 
       @write_timeout = write_timeout
       StripeClient.clear_all_connection_managers(config: self)
@@ -177,10 +161,10 @@ def ca_bundle_path=(path)
     # and is itself not thread safe.
     def ca_store
       @ca_store ||= begin
-                      store = OpenSSL::X509::Store.new
-                      store.add_file(ca_bundle_path)
-                      store
-                    end
+        store = OpenSSL::X509::Store.new
+        store.add_file(ca_bundle_path)
+        store
+      end
     end
 
     def enable_telemetry?
diff --git a/lib/stripe/stripe_object.rb b/lib/stripe/stripe_object.rb
index e565c7466..1df9c59bf 100644
--- a/lib/stripe/stripe_object.rb
+++ b/lib/stripe/stripe_object.rb
@@ -320,8 +320,8 @@ class << self; self; end
               # Here we swallow that error and issue a warning so at least
               # the program doesn't crash.
               warn("WARNING: Unable to remove method `#{method_name}`; " \
-                "if custom, please consider renaming to a name that doesn't " \
-                "collide with an API property name.")
+                   "if custom, please consider renaming to a name that doesn't " \
+                   "collide with an API property name.")
             end
           end
         end
@@ -351,17 +351,15 @@ class << self; self; end
           define_method(:"#{k}=") do |v|
             if v == ""
               raise ArgumentError, "You cannot set #{k} to an empty string. " \
-                "We interpret empty strings as nil in requests. " \
-                "You may set (object).#{k} = nil to delete the property."
+                                   "We interpret empty strings as nil in requests. " \
+                                   "You may set (object).#{k} = nil to delete the property."
             end
             @values[k] = Util.convert_to_stripe_object(v, @opts)
             dirty_value!(@values[k])
             @unsaved_values.add(k)
           end
 
-          if [FalseClass, TrueClass].include?(values[k].class)
-            define_method(:"#{k}?") { @values[k] }
-          end
+          define_method(:"#{k}?") { @values[k] } if [FalseClass, TrueClass].include?(values[k].class)
         end
       end
     end
@@ -369,7 +367,6 @@ class << self; self; end
     # Disabling the cop because it's confused by the fact that the methods are
     # protected, but we do define `#respond_to_missing?` just below. Hopefully
     # this is fixed in more recent Rubocop versions.
-    # rubocop:disable Style/MissingRespondToMissing
     protected def method_missing(name, *args)
       # TODO: only allow setting in updateable classes.
       if name.to_s.end_with?("=")
@@ -405,16 +402,14 @@ class << self; self; end
 
         raise NoMethodError,
               e.message + ".  HINT: The '#{name}' attribute was set in the " \
-              "past, however.  It was then wiped when refreshing the object " \
-              "with the result returned by Stripe's API, probably as a " \
-              "result of a save().  The attributes currently available on " \
-              "this object are: #{@values.keys.join(', ')}"
+                          "past, however.  It was then wiped when refreshing the object " \
+                          "with the result returned by Stripe's API, probably as a " \
+                          "result of a save().  The attributes currently available on " \
+                          "this object are: #{@values.keys.join(', ')}"
       end
     end
-    # rubocop:enable Style/MissingRespondToMissing
-
     protected def respond_to_missing?(symbol, include_private = false)
-      @values && @values.key?(symbol) || super
+      (@values && @values.key?(symbol)) || super
     end
 
     # Re-initializes the object based on a hash of values (usually one that's
@@ -460,7 +455,8 @@ class << self; self; end
       self
     end
 
-    protected def serialize_params_value(value, original, unsaved, force,
+    # rubocop:todo Metrics/PerceivedComplexity
+    protected def serialize_params_value(value, original, unsaved, force, # rubocop:todo Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
                                          key: nil)
       if value.nil?
         ""
@@ -494,8 +490,8 @@ class << self; self; end
           value
         else
           raise ArgumentError, "Cannot save property `#{key}` containing " \
-            "an API resource. It doesn't appear to be persisted and is " \
-            "not marked as `save_with_parent`."
+                               "an API resource. It doesn't appear to be persisted and is " \
+                               "not marked as `save_with_parent`."
         end
 
       elsif value.is_a?(Array)
@@ -535,6 +531,7 @@ class << self; self; end
         value
       end
     end
+    # rubocop:enable Metrics/PerceivedComplexity
 
     # Produces a deep copy of the given object including support for arrays,
     # hashes, and StripeObjects.
diff --git a/lib/stripe/stripe_response.rb b/lib/stripe/stripe_response.rb
index 8c8413105..cb5ea2ce3 100644
--- a/lib/stripe/stripe_response.rb
+++ b/lib/stripe/stripe_response.rb
@@ -41,9 +41,7 @@ def initialize(hash)
 
     def [](name)
       values = @hash[name.downcase]
-      if values && values.count > 1
-        warn("Duplicate header values for `#{name}`; returning only first")
-      end
+      warn("Duplicate header values for `#{name}`; returning only first") if values && values.count > 1
       values ? values.first : nil
     end
   end
diff --git a/lib/stripe/util.rb b/lib/stripe/util.rb
index 4f6db536e..56d553811 100644
--- a/lib/stripe/util.rb
+++ b/lib/stripe/util.rb
@@ -79,8 +79,8 @@ def self.custom_method(resource, target, name, http_verb, http_path)
                 "id should be a string representing the ID of an API resource"
         end
 
-        url = "#{target.resource_url}/"\
-              "#{CGI.escape(id)}/"\
+        url = "#{target.resource_url}/" \
+              "#{CGI.escape(id)}/" \
               "#{CGI.escape(http_path)}"
 
         resp, opts = resource.execute_resource_request(
@@ -139,9 +139,7 @@ def self.convert_to_stripe_object_with_params(data, params, opts = {})
 
         # set filters so that we can fetch the same limit, expansions, and
         # predicates when accessing the next and previous pages
-        if obj && (obj.is_a?(SearchResultObject) || obj.is_a?(ListObject))
-          obj.filters = params.dup
-        end
+        obj.filters = params.dup if obj && (obj.is_a?(SearchResultObject) || obj.is_a?(ListObject))
 
         obj
       else
@@ -153,7 +151,7 @@ def self.log_error(message, data = {})
       config = data.delete(:config) || Stripe.config
       logger = config.logger || Stripe.logger
       if !logger.nil? ||
-         !config.log_level.nil? && config.log_level <= Stripe::LEVEL_ERROR
+         (!config.log_level.nil? && config.log_level <= Stripe::LEVEL_ERROR)
         log_internal(message, data, color: :cyan, level: Stripe::LEVEL_ERROR,
                                     logger: Stripe.logger, out: $stderr)
       end
@@ -163,7 +161,7 @@ def self.log_info(message, data = {})
       config = data.delete(:config) || Stripe.config
       logger = config.logger || Stripe.logger
       if !logger.nil? ||
-         !config.log_level.nil? && config.log_level <= Stripe::LEVEL_INFO
+         (!config.log_level.nil? && config.log_level <= Stripe::LEVEL_INFO)
         log_internal(message, data, color: :cyan, level: Stripe::LEVEL_INFO,
                                     logger: Stripe.logger, out: $stdout)
       end
@@ -173,7 +171,7 @@ def self.log_debug(message, data = {})
       config = data.delete(:config) || Stripe.config
       logger = config.logger || Stripe.logger
       if !logger.nil? ||
-         !config.log_level.nil? && config.log_level <= Stripe::LEVEL_DEBUG
+         (!config.log_level.nil? && config.log_level <= Stripe::LEVEL_DEBUG)
         log_internal(message, data, color: :blue, level: Stripe::LEVEL_DEBUG,
                                     logger: Stripe.logger, out: $stdout)
       end
@@ -185,10 +183,10 @@ def self.symbolize_names(object)
         new_hash = {}
         object.each do |key, value|
           key = (begin
-                   key.to_sym
-                 rescue StandardError
-                   key
-                 end) || key
+            key.to_sym
+          rescue StandardError
+            key
+          end) || key
           new_hash[key] = symbolize_names(value)
         end
         new_hash
diff --git a/test/stripe/account_link_test.rb b/test/stripe/account_link_test.rb
index 097b7e42a..579cca9b6 100644
--- a/test/stripe/account_link_test.rb
+++ b/test/stripe/account_link_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class AccountLinkTest < Test::Unit::TestCase
diff --git a/test/stripe/account_test.rb b/test/stripe/account_test.rb
index e4a135e31..7ac373fb0 100644
--- a/test/stripe/account_test.rb
+++ b/test/stripe/account_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class AccountTest < Test::Unit::TestCase
@@ -116,8 +116,7 @@ class AccountTest < Test::Unit::TestCase
       should "serialize a new additional_owners" do
         obj = Stripe::Util.convert_to_stripe_object({
           object: "account",
-          legal_entity: Stripe::StripeObject.construct_from({
-          }),
+          legal_entity: Stripe::StripeObject.construct_from({}),
         }, {})
         obj.legal_entity.additional_owners = [
           { first_name: "Joe" },
diff --git a/test/stripe/api_operations_test.rb b/test/stripe/api_operations_test.rb
index acaa81cb8..e171ee92e 100644
--- a/test/stripe/api_operations_test.rb
+++ b/test/stripe/api_operations_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ApiOperationsTest < Test::Unit::TestCase
@@ -40,7 +40,7 @@ def self.protected_fields
     end
 
     context ".nested_resource_class_methods" do
-      class MainResource < APIResource
+      class MainResource < APIResource # rubocop:todo Lint/ConstantDefinitionInBlock
         extend Stripe::APIOperations::NestedResource
         OBJECT_NAME = "mainresource"
         nested_resource_class_methods :nested,
diff --git a/test/stripe/api_resource_test.rb b/test/stripe/api_resource_test.rb
index 948bfbbbe..a0b3a98fe 100644
--- a/test/stripe/api_resource_test.rb
+++ b/test/stripe/api_resource_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ApiResourceTest < Test::Unit::TestCase
@@ -266,7 +266,7 @@ class NestedTestAPIResource < APIResource
           Stripe::Charge.create({ amount: 100, currency: "usd" }, idempotency_key: :foo)
         end
         assert_equal "request option 'idempotency_key' should be a string value " \
-                       "(was a Symbol)",
+                     "(was a Symbol)",
                      e.message
       end
 
@@ -578,7 +578,7 @@ class NestedTestAPIResource < APIResource
     end
 
     context "#request_stripe_object" do
-      class HelloTestAPIResource < APIResource
+      class HelloTestAPIResource < APIResource # rubocop:todo Lint/ConstantDefinitionInBlock
         OBJECT_NAME = "hello"
         def say_hello(params = {}, opts = {})
           request_stripe_object(
@@ -655,7 +655,7 @@ def say_hello(params = {}, opts = {})
     end
 
     context "#request_stream" do
-      class StreamTestAPIResource < APIResource
+      class StreamTestAPIResource < APIResource # rubocop:todo Lint/ConstantDefinitionInBlock
         OBJECT_NAME = "stream"
         def read_stream(params = {}, opts = {}, &read_body_chunk_block)
           request_stream(
@@ -707,7 +707,7 @@ def read_stream(params = {}, opts = {}, &read_body_chunk_block)
     end
 
     context "test helpers" do
-      class TestHelperAPIResource < APIResource
+      class TestHelperAPIResource < APIResource # rubocop:todo Lint/ConstantDefinitionInBlock
         OBJECT_NAME = "hello"
 
         def test_helpers
diff --git a/test/stripe/apple_pay_domain_test.rb b/test/stripe/apple_pay_domain_test.rb
index 088d94c7d..280c9f50b 100644
--- a/test/stripe/apple_pay_domain_test.rb
+++ b/test/stripe/apple_pay_domain_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ApplePayDomainTest < Test::Unit::TestCase
@@ -23,7 +23,7 @@ class ApplePayDomainTest < Test::Unit::TestCase
       assert domain.is_a?(Stripe::ApplePayDomain)
     end
 
-    should "be deletable" do
+    should "be deletable" do # rubocop:todo Lint/EmptyBlock
     end
 
     context "#delete" do
diff --git a/test/stripe/application_fee_refund_test.rb b/test/stripe/application_fee_refund_test.rb
index c63594fa1..6817090d4 100644
--- a/test/stripe/application_fee_refund_test.rb
+++ b/test/stripe/application_fee_refund_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ApplicationFeeRefundTest < Test::Unit::TestCase
diff --git a/test/stripe/application_fee_test.rb b/test/stripe/application_fee_test.rb
index f937cf2f8..8a431dbf3 100644
--- a/test/stripe/application_fee_test.rb
+++ b/test/stripe/application_fee_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ApplicationFeeTest < Test::Unit::TestCase
diff --git a/test/stripe/balance_test.rb b/test/stripe/balance_test.rb
index 56e1b7b4f..4ec5061ab 100644
--- a/test/stripe/balance_test.rb
+++ b/test/stripe/balance_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class BalanceTest < Test::Unit::TestCase
diff --git a/test/stripe/balance_transaction_test.rb b/test/stripe/balance_transaction_test.rb
index 532b636a4..85e6217c2 100644
--- a/test/stripe/balance_transaction_test.rb
+++ b/test/stripe/balance_transaction_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class BalanceTransactionTest < Test::Unit::TestCase
diff --git a/test/stripe/bank_account_test.rb b/test/stripe/bank_account_test.rb
index 92b95461f..afa6f4245 100644
--- a/test/stripe/bank_account_test.rb
+++ b/test/stripe/bank_account_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class BankAccountTest < Test::Unit::TestCase
diff --git a/test/stripe/billing_portal/configuration_test.rb b/test/stripe/billing_portal/configuration_test.rb
index bc0ce6522..e56faab3a 100644
--- a/test/stripe/billing_portal/configuration_test.rb
+++ b/test/stripe/billing_portal/configuration_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module BillingPortal
diff --git a/test/stripe/billing_portal/session_test.rb b/test/stripe/billing_portal/session_test.rb
index 440279a58..8a5368c28 100644
--- a/test/stripe/billing_portal/session_test.rb
+++ b/test/stripe/billing_portal/session_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module BillingPortal
diff --git a/test/stripe/capability_test.rb b/test/stripe/capability_test.rb
index 1b1c5655b..698e28d12 100644
--- a/test/stripe/capability_test.rb
+++ b/test/stripe/capability_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class CapabilityTest < Test::Unit::TestCase
diff --git a/test/stripe/charge_test.rb b/test/stripe/charge_test.rb
index 2cbcf0e6a..a6e6e4fad 100644
--- a/test/stripe/charge_test.rb
+++ b/test/stripe/charge_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ChargeTest < Test::Unit::TestCase
diff --git a/test/stripe/checkout/session_test.rb b/test/stripe/checkout/session_test.rb
index 9eace153f..08d93139a 100644
--- a/test/stripe/checkout/session_test.rb
+++ b/test/stripe/checkout/session_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Checkout
diff --git a/test/stripe/connection_manager_test.rb b/test/stripe/connection_manager_test.rb
index e70468c22..1ac0d0f7f 100644
--- a/test/stripe/connection_manager_test.rb
+++ b/test/stripe/connection_manager_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ConnectionManagerTest < Test::Unit::TestCase
diff --git a/test/stripe/country_spec_test.rb b/test/stripe/country_spec_test.rb
index 2f82066d9..c497f1c96 100644
--- a/test/stripe/country_spec_test.rb
+++ b/test/stripe/country_spec_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class CountrySpecTest < Test::Unit::TestCase
diff --git a/test/stripe/coupon_test.rb b/test/stripe/coupon_test.rb
index 7e3f95e7e..0fbdbd51f 100644
--- a/test/stripe/coupon_test.rb
+++ b/test/stripe/coupon_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class CouponTest < Test::Unit::TestCase
diff --git a/test/stripe/credit_note_test.rb b/test/stripe/credit_note_test.rb
index e75c2239d..d1660f116 100644
--- a/test/stripe/credit_note_test.rb
+++ b/test/stripe/credit_note_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class CreditNoteTest < Test::Unit::TestCase
diff --git a/test/stripe/customer_balance_transaction_test.rb b/test/stripe/customer_balance_transaction_test.rb
index b577c5259..b6fca01b6 100644
--- a/test/stripe/customer_balance_transaction_test.rb
+++ b/test/stripe/customer_balance_transaction_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __FILE__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class CustomerBalanceTransactionTest < Test::Unit::TestCase
diff --git a/test/stripe/customer_card_test.rb b/test/stripe/customer_card_test.rb
index 73a0710a6..84c4464ad 100644
--- a/test/stripe/customer_card_test.rb
+++ b/test/stripe/customer_card_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class CustomerCardTest < Test::Unit::TestCase
diff --git a/test/stripe/customer_test.rb b/test/stripe/customer_test.rb
index 66070b69d..81eacbd91 100644
--- a/test/stripe/customer_test.rb
+++ b/test/stripe/customer_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class CustomerTest < Test::Unit::TestCase
diff --git a/test/stripe/dispute_test.rb b/test/stripe/dispute_test.rb
index 7e955efdd..f772e8fed 100644
--- a/test/stripe/dispute_test.rb
+++ b/test/stripe/dispute_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class DisputeTest < Test::Unit::TestCase
diff --git a/test/stripe/ephemeral_key_test.rb b/test/stripe/ephemeral_key_test.rb
index f0fe408bc..f35d6d495 100644
--- a/test/stripe/ephemeral_key_test.rb
+++ b/test/stripe/ephemeral_key_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class EphemeralKeyTest < Test::Unit::TestCase
diff --git a/test/stripe/errors_test.rb b/test/stripe/errors_test.rb
index 677976e11..85a611d0d 100644
--- a/test/stripe/errors_test.rb
+++ b/test/stripe/errors_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class StripeErrorTest < Test::Unit::TestCase
diff --git a/test/stripe/exchange_rate_test.rb b/test/stripe/exchange_rate_test.rb
index 865887f55..a756dc60c 100644
--- a/test/stripe/exchange_rate_test.rb
+++ b/test/stripe/exchange_rate_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ExchangeRateTest < Test::Unit::TestCase
diff --git a/test/stripe/file_link_test.rb b/test/stripe/file_link_test.rb
index 438ffad31..4ab8645aa 100644
--- a/test/stripe/file_link_test.rb
+++ b/test/stripe/file_link_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class FileLinkTest < Test::Unit::TestCase
diff --git a/test/stripe/file_test.rb b/test/stripe/file_test.rb
index 1b16f5bbe..e35de1cb6 100644
--- a/test/stripe/file_test.rb
+++ b/test/stripe/file_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class FileTest < Test::Unit::TestCase
diff --git a/test/stripe/generated_examples_test.rb b/test/stripe/generated_examples_test.rb
index 851fb193f..457aef51c 100644
--- a/test/stripe/generated_examples_test.rb
+++ b/test/stripe/generated_examples_test.rb
@@ -1,7 +1,7 @@
 # File generated from our OpenAPI spec
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 module Stripe
   class CodegennedExampleTest < Test::Unit::TestCase
     should "Test account links post" do
diff --git a/test/stripe/identity/verification_report_test.rb b/test/stripe/identity/verification_report_test.rb
index 014362aa6..379bd5323 100644
--- a/test/stripe/identity/verification_report_test.rb
+++ b/test/stripe/identity/verification_report_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Identity
diff --git a/test/stripe/identity/verification_session_test.rb b/test/stripe/identity/verification_session_test.rb
index 254a7e84a..2abcf0ff4 100644
--- a/test/stripe/identity/verification_session_test.rb
+++ b/test/stripe/identity/verification_session_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Identity
diff --git a/test/stripe/invoice_item_test.rb b/test/stripe/invoice_item_test.rb
index 04a3fc1b6..1b79d57dd 100644
--- a/test/stripe/invoice_item_test.rb
+++ b/test/stripe/invoice_item_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class InvoiceItemTest < Test::Unit::TestCase
diff --git a/test/stripe/invoice_line_item_test.rb b/test/stripe/invoice_line_item_test.rb
index 8515dce8c..0a89776bc 100644
--- a/test/stripe/invoice_line_item_test.rb
+++ b/test/stripe/invoice_line_item_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class InvoiceLineItemTest < Test::Unit::TestCase
diff --git a/test/stripe/invoice_test.rb b/test/stripe/invoice_test.rb
index 468a2cabb..9a5a6d18f 100644
--- a/test/stripe/invoice_test.rb
+++ b/test/stripe/invoice_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class InvoiceTest < Test::Unit::TestCase
diff --git a/test/stripe/issuing/authorization_test.rb b/test/stripe/issuing/authorization_test.rb
index 2134a6117..cc3c16d2b 100644
--- a/test/stripe/issuing/authorization_test.rb
+++ b/test/stripe/issuing/authorization_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Issuing
diff --git a/test/stripe/issuing/card_test.rb b/test/stripe/issuing/card_test.rb
index 243ac047f..c1d9120ee 100644
--- a/test/stripe/issuing/card_test.rb
+++ b/test/stripe/issuing/card_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Issuing
diff --git a/test/stripe/issuing/cardholder_test.rb b/test/stripe/issuing/cardholder_test.rb
index 0ae7151d7..524f6ff3c 100644
--- a/test/stripe/issuing/cardholder_test.rb
+++ b/test/stripe/issuing/cardholder_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Issuing
diff --git a/test/stripe/issuing/dispute_test.rb b/test/stripe/issuing/dispute_test.rb
index b0299afe5..6a960ac22 100644
--- a/test/stripe/issuing/dispute_test.rb
+++ b/test/stripe/issuing/dispute_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Issuing
diff --git a/test/stripe/issuing/transaction_test.rb b/test/stripe/issuing/transaction_test.rb
index dd3e0fa03..4e00ffe30 100644
--- a/test/stripe/issuing/transaction_test.rb
+++ b/test/stripe/issuing/transaction_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Issuing
diff --git a/test/stripe/list_object_test.rb b/test/stripe/list_object_test.rb
index f65ee5ee1..ccbaff0ea 100644
--- a/test/stripe/list_object_test.rb
+++ b/test/stripe/list_object_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ListObjectTest < Test::Unit::TestCase
diff --git a/test/stripe/login_link_test.rb b/test/stripe/login_link_test.rb
index 8682e2616..3a5aba993 100644
--- a/test/stripe/login_link_test.rb
+++ b/test/stripe/login_link_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class LoginLinkTest < Test::Unit::TestCase
diff --git a/test/stripe/mandate_test.rb b/test/stripe/mandate_test.rb
index 4f8724785..513aa6b26 100644
--- a/test/stripe/mandate_test.rb
+++ b/test/stripe/mandate_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class MandateTest < Test::Unit::TestCase
diff --git a/test/stripe/multipart_encoder_test.rb b/test/stripe/multipart_encoder_test.rb
index 10eb4df32..5ab469d7a 100644
--- a/test/stripe/multipart_encoder_test.rb
+++ b/test/stripe/multipart_encoder_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class MultipartEncoderTest < Test::Unit::TestCase
diff --git a/test/stripe/oauth_test.rb b/test/stripe/oauth_test.rb
index be7b4dc56..5e365446e 100644
--- a/test/stripe/oauth_test.rb
+++ b/test/stripe/oauth_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class OAuthTest < Test::Unit::TestCase
@@ -83,7 +83,7 @@ class OAuthTest < Test::Unit::TestCase
             "grant_type" => "authorization_code",
             "code" => "this_is_an_authorization_code",
           })
-          .with(headers: { "Authorization": "Bearer client_secret_override" })
+          .with(headers: { Authorization: "Bearer client_secret_override" })
           .to_return(body: JSON.generate(access_token: "another_access_token"))
 
         resp = OAuth.token(client_secret: "client_secret_override",
diff --git a/test/stripe/payment_intent_test.rb b/test/stripe/payment_intent_test.rb
index d5832334a..d6e15adb3 100644
--- a/test/stripe/payment_intent_test.rb
+++ b/test/stripe/payment_intent_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class PaymentIntentTest < Test::Unit::TestCase
diff --git a/test/stripe/payment_method_test.rb b/test/stripe/payment_method_test.rb
index 04d52d314..810318838 100644
--- a/test/stripe/payment_method_test.rb
+++ b/test/stripe/payment_method_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class PaymentMethodTest < Test::Unit::TestCase
diff --git a/test/stripe/payout_test.rb b/test/stripe/payout_test.rb
index d7c197881..83bdd2b04 100644
--- a/test/stripe/payout_test.rb
+++ b/test/stripe/payout_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class PayoutTest < Test::Unit::TestCase
diff --git a/test/stripe/person_test.rb b/test/stripe/person_test.rb
index f3d90e5c2..6be326731 100644
--- a/test/stripe/person_test.rb
+++ b/test/stripe/person_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class PersonTest < Test::Unit::TestCase
diff --git a/test/stripe/plan_test.rb b/test/stripe/plan_test.rb
index f9d4b295e..a82b9128f 100644
--- a/test/stripe/plan_test.rb
+++ b/test/stripe/plan_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class PlanTest < Test::Unit::TestCase
diff --git a/test/stripe/price_test.rb b/test/stripe/price_test.rb
index fdaf3d4f3..4b1ca95c0 100644
--- a/test/stripe/price_test.rb
+++ b/test/stripe/price_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class PriceTest < Test::Unit::TestCase
diff --git a/test/stripe/product_test.rb b/test/stripe/product_test.rb
index a5ac09484..e26b1ada1 100644
--- a/test/stripe/product_test.rb
+++ b/test/stripe/product_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ProductTest < Test::Unit::TestCase
diff --git a/test/stripe/promotion_code_test.rb b/test/stripe/promotion_code_test.rb
index b09a8d941..82e547ae0 100644
--- a/test/stripe/promotion_code_test.rb
+++ b/test/stripe/promotion_code_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class PromotionCodeTest < Test::Unit::TestCase
diff --git a/test/stripe/quote_test.rb b/test/stripe/quote_test.rb
index 164cc546c..586bfe39a 100644
--- a/test/stripe/quote_test.rb
+++ b/test/stripe/quote_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class QuoteTest < Test::Unit::TestCase
@@ -191,7 +191,7 @@ class QuoteTest < Test::Unit::TestCase
 
         should "raise when no ID is passed" do
           assert_raises ArgumentError do
-            Stripe::Quote.pdf do |read_body_chunk|
+            Stripe::Quote.pdf do |read_body_chunk| # rubocop:todo Lint/EmptyBlock
             end
           end
         end
diff --git a/test/stripe/radar/early_fraud_warning_test.rb b/test/stripe/radar/early_fraud_warning_test.rb
index 8b52a4510..ee9280ed4 100644
--- a/test/stripe/radar/early_fraud_warning_test.rb
+++ b/test/stripe/radar/early_fraud_warning_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Radar
diff --git a/test/stripe/radar/value_list_item_test.rb b/test/stripe/radar/value_list_item_test.rb
index 1d29a7769..5608a37c5 100644
--- a/test/stripe/radar/value_list_item_test.rb
+++ b/test/stripe/radar/value_list_item_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Radar
diff --git a/test/stripe/radar/value_list_test.rb b/test/stripe/radar/value_list_test.rb
index ce2ddd13d..2270b7ff5 100644
--- a/test/stripe/radar/value_list_test.rb
+++ b/test/stripe/radar/value_list_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Radar
diff --git a/test/stripe/refund_test.rb b/test/stripe/refund_test.rb
index 65c724096..58a6cdae9 100644
--- a/test/stripe/refund_test.rb
+++ b/test/stripe/refund_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class RefundTest < Test::Unit::TestCase
diff --git a/test/stripe/reporting/report_run_test.rb b/test/stripe/reporting/report_run_test.rb
index 191c6cd85..7ec6b22d9 100644
--- a/test/stripe/reporting/report_run_test.rb
+++ b/test/stripe/reporting/report_run_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Reporting
diff --git a/test/stripe/reporting/report_type_test.rb b/test/stripe/reporting/report_type_test.rb
index c70169fba..1b34ec42e 100644
--- a/test/stripe/reporting/report_type_test.rb
+++ b/test/stripe/reporting/report_type_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Reporting
diff --git a/test/stripe/reversal_test.rb b/test/stripe/reversal_test.rb
index e9dd7fcd4..009f93566 100644
--- a/test/stripe/reversal_test.rb
+++ b/test/stripe/reversal_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ReversalTest < Test::Unit::TestCase
diff --git a/test/stripe/review_test.rb b/test/stripe/review_test.rb
index f2a6525d8..f1d066715 100644
--- a/test/stripe/review_test.rb
+++ b/test/stripe/review_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class ReviewTest < Test::Unit::TestCase
diff --git a/test/stripe/search_result_object_test.rb b/test/stripe/search_result_object_test.rb
index fda3a78e6..9a87ff944 100644
--- a/test/stripe/search_result_object_test.rb
+++ b/test/stripe/search_result_object_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class SearchResultObjectTest < Test::Unit::TestCase
@@ -113,7 +113,7 @@ class SearchResultObjectTest < Test::Unit::TestCase
                                                    object: "search_result")
       list.filters = { limit: 3 }
       stub_request(:get, "#{Stripe.api_base}/things")
-        .with(query: { "limit": 3, page: "next_page_token_1" })
+        .with(query: { limit: 3, page: "next_page_token_1" })
         .to_return(body: JSON.generate(data: [{ id: 2 }], has_more: false, object: "search_result"))
       next_list = list.next_search_result_page
       assert_equal({ limit: 3, page: "next_page_token_1" }, next_list.filters)
diff --git a/test/stripe/setup_attempt_test.rb b/test/stripe/setup_attempt_test.rb
index 6d22d5195..bc38be4a0 100644
--- a/test/stripe/setup_attempt_test.rb
+++ b/test/stripe/setup_attempt_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class SetupAttemptTest < Test::Unit::TestCase
diff --git a/test/stripe/setup_intent_test.rb b/test/stripe/setup_intent_test.rb
index 4ce3eafcb..f4830cf19 100644
--- a/test/stripe/setup_intent_test.rb
+++ b/test/stripe/setup_intent_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class SetupIntentTest < Test::Unit::TestCase
diff --git a/test/stripe/sigma/scheduled_query_run_test.rb b/test/stripe/sigma/scheduled_query_run_test.rb
index cceceaf03..ef13f3576 100644
--- a/test/stripe/sigma/scheduled_query_run_test.rb
+++ b/test/stripe/sigma/scheduled_query_run_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Issuing
diff --git a/test/stripe/source_test.rb b/test/stripe/source_test.rb
index c11658586..944d03ce0 100644
--- a/test/stripe/source_test.rb
+++ b/test/stripe/source_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class SourceTest < Test::Unit::TestCase
diff --git a/test/stripe/stripe_client_test.rb b/test/stripe/stripe_client_test.rb
index 0ec61155b..ff5178695 100644
--- a/test/stripe/stripe_client_test.rb
+++ b/test/stripe/stripe_client_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class StripeClientTest < Test::Unit::TestCase
@@ -449,9 +449,7 @@ class StripeClientTest < Test::Unit::TestCase
     %w[execute_request execute_request_stream].each do |request_method|
       context "request processing for #{request_method}" do
         setup do
-          @read_body_chunk_block = if request_method == "execute_request_stream"
-                                     proc { |body_chunk| body_chunk }
-                                   end
+          @read_body_chunk_block = (proc { |body_chunk| body_chunk } if request_method == "execute_request_stream")
         end
 
         context "headers" do
@@ -506,7 +504,7 @@ class StripeClientTest < Test::Unit::TestCase
                 data[:thread_object_id] == Thread.current.object_id &&
                 (data[:connection_manager_object_id].is_a? Numeric) &&
                 (data[:connection_object_id].is_a? Numeric) &&
-                data[:log_timestamp] == 0.0
+                data[:log_timestamp] == 0.0 # rubocop:todo Lint/FloatComparison
             end
 
             response_object_id = nil
@@ -520,7 +518,7 @@ class StripeClientTest < Test::Unit::TestCase
                  data[:connection_manager_object_id] == connection_manager_data[:connection_manager_object_id] &&
                  data[:connection_object_id] == connection_manager_data[:connection_object_id] &&
                  (data[:response_object_id].is_a? Numeric) &&
-                 data[:log_timestamp] == 0.0
+                 data[:log_timestamp] == 0.0 # rubocop:todo Lint/FloatComparison
                 response_object_id = data[:response_object_id]
               end
             end
@@ -560,7 +558,7 @@ class StripeClientTest < Test::Unit::TestCase
                  data[:process_id] == Process.pid &&
                  data[:thread_object_id] == Thread.current.object_id &&
                  data[:response_object_id] == response_object_id &&
-                 data[:log_timestamp] == 0.0
+                 data[:log_timestamp] == 0.0 # rubocop:todo Lint/FloatComparison
                 # Streaming requests have a different body.
                 if request_method == "execute_request_stream"
                   data[:body].is_a? Net::ReadAdapter
@@ -807,7 +805,7 @@ class StripeClientTest < Test::Unit::TestCase
               client.send(request_method, :post, "/v1/charges",
                           &@read_body_chunk_block)
             end
-            assert_equal StripeClient::ERROR_MESSAGE_CONNECTION % Stripe.api_base +
+            assert_equal (StripeClient::ERROR_MESSAGE_CONNECTION % Stripe.api_base) +
                          "\n\n(Network error: Connection refused)",
                          e.message
           end
@@ -1251,7 +1249,7 @@ class StripeClientTest < Test::Unit::TestCase
           StripeClient.current_thread_context.active_client = :stripe_client
 
           client = StripeClient.new
-          client.request {}
+          client.request {} # rubocop:todo Lint/EmptyBlock
 
           assert_equal :stripe_client,
                        StripeClient.current_thread_context.active_client
@@ -1344,7 +1342,7 @@ class StripeClientTest < Test::Unit::TestCase
         client = StripeClient.new
         client.request do
           e = assert_raises(RuntimeError) do
-            client.request {}
+            client.request {} # rubocop:todo Lint/EmptyBlock
           end
           assert_equal "calls to StripeClient#request cannot be nested within a thread",
                        e.message
@@ -1360,7 +1358,7 @@ class StripeClientTest < Test::Unit::TestCase
           Stripe.proxy = "http://user:pass@localhost:8080"
 
           client = StripeClient.new
-          client.request {}
+          client.request {} # rubocop:todo Lint/EmptyBlock
 
           connection = Stripe::StripeClient.default_connection_manager.connection_for(Stripe.api_base)
 
diff --git a/test/stripe/stripe_configuration_test.rb b/test/stripe/stripe_configuration_test.rb
index fe8b8b006..01e1a7921 100644
--- a/test/stripe/stripe_configuration_test.rb
+++ b/test/stripe/stripe_configuration_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class StripeConfigurationTest < Test::Unit::TestCase
diff --git a/test/stripe/stripe_object_test.rb b/test/stripe/stripe_object_test.rb
index 47aeed25a..80dde23dc 100644
--- a/test/stripe/stripe_object_test.rb
+++ b/test/stripe/stripe_object_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class StripeObjectTest < Test::Unit::TestCase
@@ -108,7 +108,7 @@ class StripeObjectTest < Test::Unit::TestCase
       end
 
       should "return an instance of the same class" do
-        class TestObject < Stripe::StripeObject; end
+        class TestObject < Stripe::StripeObject; end # rubocop:todo Lint/ConstantDefinitionInBlock
 
         obj = TestObject.construct_from(id: 1)
         copy_obj = obj.class.send(:deep_copy, obj)
@@ -349,7 +349,7 @@ def to_hash
     end
 
     should "#serialize_params with StripeObject that's been replaced which is `metadata`" do
-      class WithAdditiveObjectParam < Stripe::StripeObject
+      class WithAdditiveObjectParam < Stripe::StripeObject # rubocop:todo Lint/ConstantDefinitionInBlock
         additive_object_param :metadata
       end
 
@@ -418,8 +418,8 @@ class WithAdditiveObjectParam < Stripe::StripeObject
         obj.serialize_params
       end
       assert_equal "Cannot save property `customer` containing " \
-        "an API resource. It doesn't appear to be persisted and is " \
-        "not marked as `save_with_parent`.", e.message
+                   "an API resource. It doesn't appear to be persisted and is " \
+                   "not marked as `save_with_parent`.", e.message
     end
 
     should "#serialize_params takes a force option" do
@@ -434,7 +434,7 @@ class WithAdditiveObjectParam < Stripe::StripeObject
       obj = Stripe::StripeObject.construct_from(id: "id",
                                                 metadata: Stripe::StripeObject.construct_from(foo: "bar"))
 
-      # note that `force` and `dirty!` are for different things, but are
+      # NOTE: that `force` and `dirty!` are for different things, but are
       # functionally equivalent
       obj.dirty!
 
diff --git a/test/stripe/stripe_response_test.rb b/test/stripe/stripe_response_test.rb
index 9fa81aa1e..2977326fc 100644
--- a/test/stripe/stripe_response_test.rb
+++ b/test/stripe/stripe_response_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class StripeResponseTest < Test::Unit::TestCase
diff --git a/test/stripe/subscription_item_test.rb b/test/stripe/subscription_item_test.rb
index 16f7a4525..87e4ea129 100644
--- a/test/stripe/subscription_item_test.rb
+++ b/test/stripe/subscription_item_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class SubscriptionItemTest < Test::Unit::TestCase
diff --git a/test/stripe/subscription_schedule_test.rb b/test/stripe/subscription_schedule_test.rb
index 150ea3afb..a574fd43e 100644
--- a/test/stripe/subscription_schedule_test.rb
+++ b/test/stripe/subscription_schedule_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class SubscriptionScheduleTest < Test::Unit::TestCase
diff --git a/test/stripe/subscription_test.rb b/test/stripe/subscription_test.rb
index eaa8f62a1..cfb525f4f 100644
--- a/test/stripe/subscription_test.rb
+++ b/test/stripe/subscription_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class SubscriptionTest < Test::Unit::TestCase
diff --git a/test/stripe/tax_code_test.rb b/test/stripe/tax_code_test.rb
index fc56e1b5c..06a78c404 100644
--- a/test/stripe/tax_code_test.rb
+++ b/test/stripe/tax_code_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class TaxCodeTest < Test::Unit::TestCase
diff --git a/test/stripe/tax_id_test.rb b/test/stripe/tax_id_test.rb
index a1f6b55ed..8a84585bb 100644
--- a/test/stripe/tax_id_test.rb
+++ b/test/stripe/tax_id_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class TaxIdTest < Test::Unit::TestCase
diff --git a/test/stripe/tax_rate_test.rb b/test/stripe/tax_rate_test.rb
index a94d1b8a1..59036972c 100644
--- a/test/stripe/tax_rate_test.rb
+++ b/test/stripe/tax_rate_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class TaxRateTest < Test::Unit::TestCase
diff --git a/test/stripe/terminal/connection_token_test.rb b/test/stripe/terminal/connection_token_test.rb
index a0f445d78..166defd2c 100644
--- a/test/stripe/terminal/connection_token_test.rb
+++ b/test/stripe/terminal/connection_token_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Terminal
diff --git a/test/stripe/terminal/location_test.rb b/test/stripe/terminal/location_test.rb
index 2cc8e701d..50a014dc3 100644
--- a/test/stripe/terminal/location_test.rb
+++ b/test/stripe/terminal/location_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Terminal
diff --git a/test/stripe/terminal/reader_test.rb b/test/stripe/terminal/reader_test.rb
index 027804ddc..1e4a7d448 100644
--- a/test/stripe/terminal/reader_test.rb
+++ b/test/stripe/terminal/reader_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../../test_helper", __dir__)
+require File.expand_path("../../test_helper", __dir__)
 
 module Stripe
   module Terminal
diff --git a/test/stripe/topup_test.rb b/test/stripe/topup_test.rb
index c3e87c92c..7135a1d4f 100644
--- a/test/stripe/topup_test.rb
+++ b/test/stripe/topup_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class TopupTest < Test::Unit::TestCase
diff --git a/test/stripe/transfer_test.rb b/test/stripe/transfer_test.rb
index 7864cea08..e3fb068fc 100644
--- a/test/stripe/transfer_test.rb
+++ b/test/stripe/transfer_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class TransferTest < Test::Unit::TestCase
diff --git a/test/stripe/usage_record_summary_test.rb b/test/stripe/usage_record_summary_test.rb
index 8a307f7bb..1cfb06ea2 100644
--- a/test/stripe/usage_record_summary_test.rb
+++ b/test/stripe/usage_record_summary_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class UsageRecordSummaryTest < Test::Unit::TestCase
diff --git a/test/stripe/util_test.rb b/test/stripe/util_test.rb
index 0da956e0d..f060bda2d 100644
--- a/test/stripe/util_test.rb
+++ b/test/stripe/util_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class UtilTest < Test::Unit::TestCase
@@ -29,7 +29,7 @@ class UtilTest < Test::Unit::TestCase
         e: [0, 1],
         f: "",
 
-        # note the empty hash won't even show up in the request
+        # NOTE: the empty hash won't even show up in the request
         g: [],
       }
       assert_equal(
diff --git a/test/stripe/webhook_endpoint_test.rb b/test/stripe/webhook_endpoint_test.rb
index fdfab9499..cb2129a39 100644
--- a/test/stripe/webhook_endpoint_test.rb
+++ b/test/stripe/webhook_endpoint_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class WebhookEndpointTest < Test::Unit::TestCase
diff --git a/test/stripe/webhook_test.rb b/test/stripe/webhook_test.rb
index 56a8d371e..98c5c7c03 100644
--- a/test/stripe/webhook_test.rb
+++ b/test/stripe/webhook_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("../test_helper", __dir__)
+require File.expand_path("../test_helper", __dir__)
 
 module Stripe
   class WebhookTest < Test::Unit::TestCase
diff --git a/test/stripe_test.rb b/test/stripe_test.rb
index c0c3bd817..151fd29e0 100644
--- a/test/stripe_test.rb
+++ b/test/stripe_test.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require ::File.expand_path("test_helper", __dir__)
+require File.expand_path("test_helper", __dir__)
 
 class StripeTest < Test::Unit::TestCase
   should "allow app_info to be configured" do
diff --git a/test/test_helper.rb b/test/test_helper.rb
index a4fd2f162..963a58f60 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -15,10 +15,10 @@
 require "shoulda/context"
 require "webmock/test_unit"
 
-PROJECT_ROOT = ::File.expand_path("../", __dir__)
+PROJECT_ROOT = File.expand_path("../", __dir__)
 
-require ::File.expand_path("test_data", __dir__)
-require ::File.expand_path("stripe_mock", __dir__)
+require File.expand_path("test_data", __dir__)
+require File.expand_path("stripe_mock", __dir__)
 
 MOCK_MINIMUM_VERSION = "0.109.0"
 MOCK_PORT = Stripe::StripeMock.start
@@ -36,18 +36,18 @@
 
   if version.nil?
     abort("Couldn't find `Stripe-Mock-Version` in response from " \
-      "`localhost:#{MOCK_PORT}`. Is the service running there stripe-mock?")
+          "`localhost:#{MOCK_PORT}`. Is the service running there stripe-mock?")
   end
 
   if version != "master" &&
      Gem::Version.new(version) < Gem::Version.new(MOCK_MINIMUM_VERSION)
     abort("Your version of stripe-mock (#{version}) is too old. The minimum " \
-      "version to run this test suite is #{MOCK_MINIMUM_VERSION}. Please " \
-      "see its repository for upgrade instructions.")
+          "version to run this test suite is #{MOCK_MINIMUM_VERSION}. Please " \
+          "see its repository for upgrade instructions.")
   end
 rescue Errno::ECONNREFUSED
   abort("Couldn't reach stripe-mock at `localhost:#{MOCK_PORT}`. Is " \
-    "it running? Please see README for setup instructions.")
+        "it running? Please see README for setup instructions.")
 end
 
 Test::Unit.at_exit do

From 41fcd5edfc4fee1c09c85ce43667c07c879cf2c5 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein <richardm@stripe.com>
Date: Mon, 27 Nov 2023 17:03:07 -0800
Subject: [PATCH 08/11] Bad NOTE:

---
 lib/stripe/api_operations/save.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/stripe/api_operations/save.rb b/lib/stripe/api_operations/save.rb
index 7dbca861a..af7d3ada9 100644
--- a/lib/stripe/api_operations/save.rb
+++ b/lib/stripe/api_operations/save.rb
@@ -62,7 +62,7 @@ def save(params = {}, opts = {})
 
         values = serialize_params(self).merge(params)
 
-        # NOTE: that id gets removed here our call to #url above has already
+        # Please note that id gets removed here our call to #url above has already
         # generated a uri for this object with an identifier baked in
         values.delete(:id)
 

From 4925d05a35c80f47281a74b5b7eae3a064a272c5 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein <richardm@stripe.com>
Date: Mon, 27 Nov 2023 17:05:40 -0800
Subject: [PATCH 09/11] Version restriction for rubocop

---
 Gemfile  | 4 +++-
 Rakefile | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Gemfile b/Gemfile
index d9ff531b1..4052d1e82 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,7 +23,9 @@ group :development do
   # `Gemfile.lock` checked in, so to prevent good builds from suddenly going
   # bad, pin to a specific version number here. Try to keep this relatively
   # up-to-date, but it's not the end of the world if it's not.
-  gem "rubocop", "1.57.2"
+  #
+  # The latest version of rubocop is only compatible with Ruby 2.7+
+  gem "rubocop", "1.57.2" if RUBY_VERSION >= "2.7"
 
   # jaro_winkler 1.5.5 installation fails for jruby
   gem "jaro_winkler", "1.5.4"
diff --git a/Rakefile b/Rakefile
index 9e928e3bc..44ae7a6c9 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,6 @@
 # frozen_string_literal: true
 
 require "rake/testtask"
-require "rubocop/rake_task"
 
 task default: %i[test rubocop]
 
@@ -9,7 +8,10 @@ Rake::TestTask.new do |t|
   t.pattern = "./test/**/*_test.rb"
 end
 
-RuboCop::RakeTask.new
+if RUBY_VERSION >= "2.7.0"
+  require "rubocop/rake_task"
+  RuboCop::RakeTask.new
+end
 
 desc "Update bundled certs"
 task :update_certs do

From 5cf8e62ef8db64e394009a4b14f6235acc93825d Mon Sep 17 00:00:00 2001
From: Richard Marmorstein <richardm@stripe.com>
Date: Mon, 27 Nov 2023 17:13:27 -0800
Subject: [PATCH 10/11] Will this fix CI

---
 Gemfile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Gemfile b/Gemfile
index 4052d1e82..c25a22f55 100644
--- a/Gemfile
+++ b/Gemfile
@@ -28,7 +28,8 @@ group :development do
   gem "rubocop", "1.57.2" if RUBY_VERSION >= "2.7"
 
   # jaro_winkler 1.5.5 installation fails for jruby
-  gem "jaro_winkler", "1.5.4"
+  # don't install on truffleruby
+  gem "jaro_winkler", "1.5.4" unless RUBY_ENGINE == "truffleruby"
 
   platforms :mri do
     gem "byebug"

From be0abdf7b5ec847f0a19818cae6f74aa0011d06c Mon Sep 17 00:00:00 2001
From: Richard Marmorstein <richardm@stripe.com>
Date: Tue, 28 Nov 2023 12:59:58 -0800
Subject: [PATCH 11/11] bump