From 9ff42b6b9d30ed8a60620dfcc61640b4229dd7d5 Mon Sep 17 00:00:00 2001 From: Brandur Date: Mon, 29 Jul 2019 14:18:53 -0700 Subject: [PATCH] Drop support for old versions of Ruby Drops support for Ruby 2.1 (EOL March 31, 2017) and 2.2 (EOL March 31, 2018). They're removed from `.travis.yml` and the gemspec and RuboCop configuration have also been updated to the new lower bound. Most of the diff here are minor updates to styling as required by RuboCop: * String literals are frozen by default, so the `.freeze` we had everywhere is now considered redundant. * We can now use Ruby 1.9 style hash syntax with string keys like `{ "foo": "bar" }`. * Converted a few heredocs over to use squiggly (leading whitespace removed) syntax. As discussed in Slack, I didn't drop support for Ruby 2.3 (EOL March 31, 2019) as we still have quite a few users on it. As far as I know dropping it doesn't get us access to any major syntax improvements or anything, so it's probably not a big deal. --- .rubocop.yml | 5 +- .rubocop_todo.yml | 6 --- .travis.yml | 4 +- lib/stripe/list_object.rb | 2 +- lib/stripe/multipart_encoder.rb | 9 ++-- lib/stripe/resources/account.rb | 2 +- lib/stripe/resources/account_link.rb | 2 +- lib/stripe/resources/alipay_account.rb | 2 +- lib/stripe/resources/apple_pay_domain.rb | 2 +- lib/stripe/resources/application_fee.rb | 2 +- .../resources/application_fee_refund.rb | 2 +- lib/stripe/resources/balance.rb | 2 +- lib/stripe/resources/balance_transaction.rb | 2 +- lib/stripe/resources/bank_account.rb | 2 +- lib/stripe/resources/bitcoin_receiver.rb | 2 +- lib/stripe/resources/bitcoin_transaction.rb | 2 +- lib/stripe/resources/capability.rb | 2 +- lib/stripe/resources/card.rb | 2 +- lib/stripe/resources/charge.rb | 2 +- lib/stripe/resources/checkout/session.rb | 2 +- lib/stripe/resources/country_spec.rb | 2 +- lib/stripe/resources/coupon.rb | 2 +- lib/stripe/resources/credit_note.rb | 2 +- lib/stripe/resources/customer.rb | 2 +- .../resources/customer_balance_transaction.rb | 2 +- lib/stripe/resources/discount.rb | 2 +- lib/stripe/resources/dispute.rb | 2 +- lib/stripe/resources/ephemeral_key.rb | 2 +- lib/stripe/resources/event.rb | 2 +- lib/stripe/resources/exchange_rate.rb | 2 +- lib/stripe/resources/file.rb | 4 +- lib/stripe/resources/file_link.rb | 2 +- lib/stripe/resources/invoice.rb | 2 +- lib/stripe/resources/invoice_item.rb | 2 +- lib/stripe/resources/invoice_line_item.rb | 2 +- lib/stripe/resources/issuer_fraud_record.rb | 2 +- lib/stripe/resources/issuing/authorization.rb | 2 +- lib/stripe/resources/issuing/card.rb | 2 +- lib/stripe/resources/issuing/card_details.rb | 2 +- lib/stripe/resources/issuing/cardholder.rb | 2 +- lib/stripe/resources/issuing/dispute.rb | 2 +- lib/stripe/resources/issuing/transaction.rb | 2 +- lib/stripe/resources/login_link.rb | 2 +- lib/stripe/resources/order.rb | 2 +- lib/stripe/resources/order_return.rb | 2 +- lib/stripe/resources/payment_intent.rb | 2 +- lib/stripe/resources/payment_method.rb | 2 +- lib/stripe/resources/payout.rb | 2 +- lib/stripe/resources/person.rb | 2 +- lib/stripe/resources/plan.rb | 2 +- lib/stripe/resources/product.rb | 2 +- .../resources/radar/early_fraud_warning.rb | 2 +- lib/stripe/resources/radar/value_list.rb | 2 +- lib/stripe/resources/radar/value_list_item.rb | 2 +- lib/stripe/resources/recipient.rb | 2 +- lib/stripe/resources/recipient_transfer.rb | 2 +- lib/stripe/resources/refund.rb | 2 +- lib/stripe/resources/reporting/report_run.rb | 2 +- lib/stripe/resources/reporting/report_type.rb | 2 +- lib/stripe/resources/reversal.rb | 2 +- lib/stripe/resources/review.rb | 2 +- lib/stripe/resources/setup_intent.rb | 2 +- .../resources/sigma/scheduled_query_run.rb | 2 +- lib/stripe/resources/sku.rb | 2 +- lib/stripe/resources/source.rb | 2 +- lib/stripe/resources/source_transaction.rb | 2 +- lib/stripe/resources/subscription.rb | 2 +- lib/stripe/resources/subscription_item.rb | 2 +- lib/stripe/resources/subscription_schedule.rb | 2 +- .../subscription_schedule_revision.rb | 2 +- lib/stripe/resources/tax_id.rb | 2 +- lib/stripe/resources/tax_rate.rb | 2 +- .../resources/terminal/connection_token.rb | 2 +- lib/stripe/resources/terminal/location.rb | 2 +- lib/stripe/resources/terminal/reader.rb | 2 +- lib/stripe/resources/three_d_secure.rb | 2 +- lib/stripe/resources/token.rb | 2 +- lib/stripe/resources/topup.rb | 2 +- lib/stripe/resources/transfer.rb | 2 +- lib/stripe/resources/usage_record.rb | 2 +- lib/stripe/resources/usage_record_summary.rb | 2 +- lib/stripe/resources/webhook_endpoint.rb | 2 +- lib/stripe/stripe_client.rb | 6 +-- lib/stripe/stripe_object.rb | 3 +- lib/stripe/util.rb | 5 +- lib/stripe/version.rb | 2 +- lib/stripe/webhook.rb | 2 +- stripe.gemspec | 2 +- test/stripe/api_operations_test.rb | 4 +- test/stripe/api_resource_test.rb | 2 +- test/stripe/multipart_encoder_test.rb | 48 +++++++++---------- test/stripe/payment_intent_test.rb | 2 +- test/stripe/setup_intent_test.rb | 2 +- test/stripe/stripe_object_test.rb | 6 +-- test/stripe/webhook_test.rb | 4 +- test/stripe_mock.rb | 4 +- test/test_helper.rb | 2 +- 97 files changed, 134 insertions(+), 142 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index e7130b785..18682165d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,7 +2,7 @@ inherit_from: .rubocop_todo.yml AllCops: DisplayCopNames: true - TargetRubyVersion: 2.1 + TargetRubyVersion: 2.3 Layout/CaseIndentation: EnforcedStyle: end @@ -39,6 +39,9 @@ Style/AccessModifierDeclarations: Style/FrozenStringLiteralComment: EnforcedStyle: always +Style/NumericPredicate: + Enabled: false + Style/StringLiterals: EnforcedStyle: double_quotes diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 73cee4a73..8d96346ef 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,12 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -Layout/ClosingHeredocIndentation: - # As far as I can tell, this lint rule just doesn't work when it comes to - # heredoc in `it` blocks. - Exclude: - - 'test/**/*' - # Offense count: 20 Metrics/AbcSize: Max: 53 diff --git a/.travis.yml b/.travis.yml index ff92f6629..8357dc927 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,11 @@ language: ruby rvm: - - 2.1 - - 2.2 - 2.3 - 2.4 - 2.5 - 2.6 - - jruby-9.0.5.0 + - jruby-9.2.7.0 notifications: email: diff --git a/lib/stripe/list_object.rb b/lib/stripe/list_object.rb index 30c6e8580..8322ba1f5 100644 --- a/lib/stripe/list_object.rb +++ b/lib/stripe/list_object.rb @@ -7,7 +7,7 @@ class ListObject < StripeObject include Stripe::APIOperations::Request include Stripe::APIOperations::Create - OBJECT_NAME = "list".freeze + OBJECT_NAME = "list" # This accessor allows a `ListObject` to inherit various filters that were # given to a predecessor. This allows for things like consistent limits, diff --git a/lib/stripe/multipart_encoder.rb b/lib/stripe/multipart_encoder.rb index fbfde51dc..6f498f68c 100644 --- a/lib/stripe/multipart_encoder.rb +++ b/lib/stripe/multipart_encoder.rb @@ -16,7 +16,7 @@ module Stripe # placed in the `Content-Type` header of a subsequent request (which includes # a boundary value). class MultipartEncoder - MULTIPART_FORM_DATA = "multipart/form-data".freeze + MULTIPART_FORM_DATA = "multipart/form-data" # A shortcut for encoding a single set of parameters and finalizing a # result. @@ -35,10 +35,9 @@ def self.encode(params) # Initializes a new multipart encoder. def initialize - # We seed this with an empty string so that it encoding defaults to UTF-8 - # instead of ASCII. The empty string is UTF-8 and new string inherits the - # encoding of the string it's seeded with. - @body = String.new("") + # Kind of weird, but required by Rubocop because the unary plus operator + # is considered faster than `Stripe.new`. + @body = +"" # Chose the same number of random bytes that Go uses in its standard # library implementation. Easily enough entropy to ensure that it won't diff --git a/lib/stripe/resources/account.rb b/lib/stripe/resources/account.rb index b28cb0a6f..9979a4a8b 100644 --- a/lib/stripe/resources/account.rb +++ b/lib/stripe/resources/account.rb @@ -9,7 +9,7 @@ class Account < APIResource include Stripe::APIOperations::Save extend Stripe::APIOperations::NestedResource - OBJECT_NAME = "account".freeze + OBJECT_NAME = "account" custom_method :reject, http_verb: :post diff --git a/lib/stripe/resources/account_link.rb b/lib/stripe/resources/account_link.rb index af6f064aa..110b17079 100644 --- a/lib/stripe/resources/account_link.rb +++ b/lib/stripe/resources/account_link.rb @@ -4,6 +4,6 @@ module Stripe class AccountLink < APIResource extend Stripe::APIOperations::Create - OBJECT_NAME = "account_link".freeze + OBJECT_NAME = "account_link" end end diff --git a/lib/stripe/resources/alipay_account.rb b/lib/stripe/resources/alipay_account.rb index 56dc5cd10..785c184cf 100644 --- a/lib/stripe/resources/alipay_account.rb +++ b/lib/stripe/resources/alipay_account.rb @@ -5,7 +5,7 @@ class AlipayAccount < APIResource include Stripe::APIOperations::Save include Stripe::APIOperations::Delete - OBJECT_NAME = "alipay_account".freeze + OBJECT_NAME = "alipay_account" def resource_url if !respond_to?(:customer) || customer.nil? diff --git a/lib/stripe/resources/apple_pay_domain.rb b/lib/stripe/resources/apple_pay_domain.rb index 740f1f10d..8bac3c1c4 100644 --- a/lib/stripe/resources/apple_pay_domain.rb +++ b/lib/stripe/resources/apple_pay_domain.rb @@ -7,7 +7,7 @@ class ApplePayDomain < APIResource include Stripe::APIOperations::Delete extend Stripe::APIOperations::List - OBJECT_NAME = "apple_pay_domain".freeze + OBJECT_NAME = "apple_pay_domain" def self.resource_url "/v1/apple_pay/domains" diff --git a/lib/stripe/resources/application_fee.rb b/lib/stripe/resources/application_fee.rb index af411aaf5..367c41d95 100644 --- a/lib/stripe/resources/application_fee.rb +++ b/lib/stripe/resources/application_fee.rb @@ -5,7 +5,7 @@ class ApplicationFee < APIResource extend Stripe::APIOperations::List extend Stripe::APIOperations::NestedResource - OBJECT_NAME = "application_fee".freeze + OBJECT_NAME = "application_fee" nested_resource_class_methods :refund, operations: %i[create retrieve update list] diff --git a/lib/stripe/resources/application_fee_refund.rb b/lib/stripe/resources/application_fee_refund.rb index a7e02566a..43465da96 100644 --- a/lib/stripe/resources/application_fee_refund.rb +++ b/lib/stripe/resources/application_fee_refund.rb @@ -5,7 +5,7 @@ class ApplicationFeeRefund < APIResource include Stripe::APIOperations::Save extend Stripe::APIOperations::List - OBJECT_NAME = "fee_refund".freeze + OBJECT_NAME = "fee_refund" def resource_url "#{ApplicationFee.resource_url}/#{CGI.escape(fee)}/refunds" \ diff --git a/lib/stripe/resources/balance.rb b/lib/stripe/resources/balance.rb index 34b9d64e2..24ea840b1 100644 --- a/lib/stripe/resources/balance.rb +++ b/lib/stripe/resources/balance.rb @@ -2,6 +2,6 @@ module Stripe class Balance < SingletonAPIResource - OBJECT_NAME = "balance".freeze + OBJECT_NAME = "balance" end end diff --git a/lib/stripe/resources/balance_transaction.rb b/lib/stripe/resources/balance_transaction.rb index 2bc646760..16c76e7e9 100644 --- a/lib/stripe/resources/balance_transaction.rb +++ b/lib/stripe/resources/balance_transaction.rb @@ -4,7 +4,7 @@ module Stripe class BalanceTransaction < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "balance_transaction".freeze + OBJECT_NAME = "balance_transaction" def self.resource_url "/v1/balance/history" diff --git a/lib/stripe/resources/bank_account.rb b/lib/stripe/resources/bank_account.rb index 833f13838..668a10824 100644 --- a/lib/stripe/resources/bank_account.rb +++ b/lib/stripe/resources/bank_account.rb @@ -6,7 +6,7 @@ class BankAccount < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "bank_account".freeze + OBJECT_NAME = "bank_account" def verify(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/verify", params, opts) diff --git a/lib/stripe/resources/bitcoin_receiver.rb b/lib/stripe/resources/bitcoin_receiver.rb index 9a5877bb8..474aeb4b9 100644 --- a/lib/stripe/resources/bitcoin_receiver.rb +++ b/lib/stripe/resources/bitcoin_receiver.rb @@ -6,7 +6,7 @@ module Stripe class BitcoinReceiver < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "bitcoin_receiver".freeze + OBJECT_NAME = "bitcoin_receiver" def self.resource_url "/v1/bitcoin/receivers" diff --git a/lib/stripe/resources/bitcoin_transaction.rb b/lib/stripe/resources/bitcoin_transaction.rb index 966937cb0..ba9dd6b22 100644 --- a/lib/stripe/resources/bitcoin_transaction.rb +++ b/lib/stripe/resources/bitcoin_transaction.rb @@ -6,7 +6,7 @@ class BitcoinTransaction < APIResource # Sources API instead: https://stripe.com/docs/sources/bitcoin extend Stripe::APIOperations::List - OBJECT_NAME = "bitcoin_transaction".freeze + OBJECT_NAME = "bitcoin_transaction" def self.resource_url "/v1/bitcoin/transactions" diff --git a/lib/stripe/resources/capability.rb b/lib/stripe/resources/capability.rb index e692efb5a..054ec040a 100644 --- a/lib/stripe/resources/capability.rb +++ b/lib/stripe/resources/capability.rb @@ -5,7 +5,7 @@ class Capability < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "capability".freeze + OBJECT_NAME = "capability" def resource_url if !respond_to?(:account) || account.nil? diff --git a/lib/stripe/resources/card.rb b/lib/stripe/resources/card.rb index 194ad2cc7..eeffd6f75 100644 --- a/lib/stripe/resources/card.rb +++ b/lib/stripe/resources/card.rb @@ -6,7 +6,7 @@ class Card < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "card".freeze + OBJECT_NAME = "card" def resource_url if respond_to?(:recipient) && !recipient.nil? && !recipient.empty? diff --git a/lib/stripe/resources/charge.rb b/lib/stripe/resources/charge.rb index f9ec48d43..d6d1c7a92 100644 --- a/lib/stripe/resources/charge.rb +++ b/lib/stripe/resources/charge.rb @@ -6,7 +6,7 @@ class Charge < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "charge".freeze + OBJECT_NAME = "charge" custom_method :capture, http_verb: :post diff --git a/lib/stripe/resources/checkout/session.rb b/lib/stripe/resources/checkout/session.rb index c821913bb..b07561609 100644 --- a/lib/stripe/resources/checkout/session.rb +++ b/lib/stripe/resources/checkout/session.rb @@ -5,7 +5,7 @@ module Checkout class Session < APIResource extend Stripe::APIOperations::Create - OBJECT_NAME = "checkout.session".freeze + OBJECT_NAME = "checkout.session" end end end diff --git a/lib/stripe/resources/country_spec.rb b/lib/stripe/resources/country_spec.rb index cddd9b8f5..54032bf85 100644 --- a/lib/stripe/resources/country_spec.rb +++ b/lib/stripe/resources/country_spec.rb @@ -4,6 +4,6 @@ module Stripe class CountrySpec < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "country_spec".freeze + OBJECT_NAME = "country_spec" end end diff --git a/lib/stripe/resources/coupon.rb b/lib/stripe/resources/coupon.rb index e795e66f3..2025422c8 100644 --- a/lib/stripe/resources/coupon.rb +++ b/lib/stripe/resources/coupon.rb @@ -7,6 +7,6 @@ class Coupon < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "coupon".freeze + OBJECT_NAME = "coupon" end end diff --git a/lib/stripe/resources/credit_note.rb b/lib/stripe/resources/credit_note.rb index 0b369f590..bdbd46d13 100644 --- a/lib/stripe/resources/credit_note.rb +++ b/lib/stripe/resources/credit_note.rb @@ -6,7 +6,7 @@ class CreditNote < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "credit_note".freeze + OBJECT_NAME = "credit_note" custom_method :void_credit_note, http_verb: :post, http_path: "void" diff --git a/lib/stripe/resources/customer.rb b/lib/stripe/resources/customer.rb index 02baef6d9..ba968cf39 100644 --- a/lib/stripe/resources/customer.rb +++ b/lib/stripe/resources/customer.rb @@ -8,7 +8,7 @@ class Customer < APIResource include Stripe::APIOperations::Save extend Stripe::APIOperations::NestedResource - OBJECT_NAME = "customer".freeze + OBJECT_NAME = "customer" nested_resource_class_methods :balance_transaction, operations: %i[create retrieve update list] diff --git a/lib/stripe/resources/customer_balance_transaction.rb b/lib/stripe/resources/customer_balance_transaction.rb index 25519bcc1..9d3e44fe1 100644 --- a/lib/stripe/resources/customer_balance_transaction.rb +++ b/lib/stripe/resources/customer_balance_transaction.rb @@ -5,7 +5,7 @@ class CustomerBalanceTransaction < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "customer_balance_transaction".freeze + OBJECT_NAME = "customer_balance_transaction" def resource_url if !respond_to?(:customer) || customer.nil? diff --git a/lib/stripe/resources/discount.rb b/lib/stripe/resources/discount.rb index a16cbc925..7fc0275b5 100644 --- a/lib/stripe/resources/discount.rb +++ b/lib/stripe/resources/discount.rb @@ -2,6 +2,6 @@ module Stripe class Discount < StripeObject - OBJECT_NAME = "discount".freeze + OBJECT_NAME = "discount" end end diff --git a/lib/stripe/resources/dispute.rb b/lib/stripe/resources/dispute.rb index 2541a3387..7978cb6e7 100644 --- a/lib/stripe/resources/dispute.rb +++ b/lib/stripe/resources/dispute.rb @@ -5,7 +5,7 @@ class Dispute < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "dispute".freeze + OBJECT_NAME = "dispute" custom_method :close, http_verb: :post diff --git a/lib/stripe/resources/ephemeral_key.rb b/lib/stripe/resources/ephemeral_key.rb index 1ad6977e3..80d460257 100644 --- a/lib/stripe/resources/ephemeral_key.rb +++ b/lib/stripe/resources/ephemeral_key.rb @@ -5,7 +5,7 @@ class EphemeralKey < APIResource extend Stripe::APIOperations::Create include Stripe::APIOperations::Delete - OBJECT_NAME = "ephemeral_key".freeze + OBJECT_NAME = "ephemeral_key" def self.create(params = {}, opts = {}) opts = Util.normalize_opts(opts) diff --git a/lib/stripe/resources/event.rb b/lib/stripe/resources/event.rb index 5a627a523..f016018b7 100644 --- a/lib/stripe/resources/event.rb +++ b/lib/stripe/resources/event.rb @@ -4,6 +4,6 @@ module Stripe class Event < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "event".freeze + OBJECT_NAME = "event" end end diff --git a/lib/stripe/resources/exchange_rate.rb b/lib/stripe/resources/exchange_rate.rb index 427d5e0aa..67f1f2c7a 100644 --- a/lib/stripe/resources/exchange_rate.rb +++ b/lib/stripe/resources/exchange_rate.rb @@ -4,6 +4,6 @@ module Stripe class ExchangeRate < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "exchange_rate".freeze + OBJECT_NAME = "exchange_rate" end end diff --git a/lib/stripe/resources/file.rb b/lib/stripe/resources/file.rb index ff9cff6e3..41979485c 100644 --- a/lib/stripe/resources/file.rb +++ b/lib/stripe/resources/file.rb @@ -5,13 +5,13 @@ class File < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List - OBJECT_NAME = "file".freeze + OBJECT_NAME = "file" # This resource can have two different object names. In latter API # versions, only `file` is used, but since stripe-ruby may be used with # any API version, we need to support deserializing the older # `file_upload` object into the same class. - OBJECT_NAME_ALT = "file_upload".freeze + OBJECT_NAME_ALT = "file_upload" def self.resource_url "/v1/files" diff --git a/lib/stripe/resources/file_link.rb b/lib/stripe/resources/file_link.rb index ea6cc64e9..e517af952 100644 --- a/lib/stripe/resources/file_link.rb +++ b/lib/stripe/resources/file_link.rb @@ -6,6 +6,6 @@ class FileLink < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "file_link".freeze + OBJECT_NAME = "file_link" end end diff --git a/lib/stripe/resources/invoice.rb b/lib/stripe/resources/invoice.rb index dfee9f9a5..dcb3614a9 100644 --- a/lib/stripe/resources/invoice.rb +++ b/lib/stripe/resources/invoice.rb @@ -7,7 +7,7 @@ class Invoice < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "invoice".freeze + OBJECT_NAME = "invoice" custom_method :finalize_invoice, http_verb: :post, http_path: "finalize" custom_method :mark_uncollectible, http_verb: :post diff --git a/lib/stripe/resources/invoice_item.rb b/lib/stripe/resources/invoice_item.rb index 350258b0b..78e1cc2cf 100644 --- a/lib/stripe/resources/invoice_item.rb +++ b/lib/stripe/resources/invoice_item.rb @@ -7,6 +7,6 @@ class InvoiceItem < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "invoiceitem".freeze + OBJECT_NAME = "invoiceitem" end end diff --git a/lib/stripe/resources/invoice_line_item.rb b/lib/stripe/resources/invoice_line_item.rb index a2056bbc4..499ad6707 100644 --- a/lib/stripe/resources/invoice_line_item.rb +++ b/lib/stripe/resources/invoice_line_item.rb @@ -2,6 +2,6 @@ module Stripe class InvoiceLineItem < StripeObject - OBJECT_NAME = "line_item".freeze + OBJECT_NAME = "line_item" end end diff --git a/lib/stripe/resources/issuer_fraud_record.rb b/lib/stripe/resources/issuer_fraud_record.rb index 76b12488b..43eb11334 100644 --- a/lib/stripe/resources/issuer_fraud_record.rb +++ b/lib/stripe/resources/issuer_fraud_record.rb @@ -4,6 +4,6 @@ module Stripe class IssuerFraudRecord < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "issuer_fraud_record".freeze + OBJECT_NAME = "issuer_fraud_record" end end diff --git a/lib/stripe/resources/issuing/authorization.rb b/lib/stripe/resources/issuing/authorization.rb index eb13be217..01e075a48 100644 --- a/lib/stripe/resources/issuing/authorization.rb +++ b/lib/stripe/resources/issuing/authorization.rb @@ -6,7 +6,7 @@ class Authorization < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "issuing.authorization".freeze + OBJECT_NAME = "issuing.authorization" custom_method :approve, http_verb: :post custom_method :decline, http_verb: :post diff --git a/lib/stripe/resources/issuing/card.rb b/lib/stripe/resources/issuing/card.rb index ba38e5dd8..d80a58a90 100644 --- a/lib/stripe/resources/issuing/card.rb +++ b/lib/stripe/resources/issuing/card.rb @@ -7,7 +7,7 @@ class Card < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "issuing.card".freeze + OBJECT_NAME = "issuing.card" custom_method :details, http_verb: :get diff --git a/lib/stripe/resources/issuing/card_details.rb b/lib/stripe/resources/issuing/card_details.rb index 4d483cd57..c215abe1e 100644 --- a/lib/stripe/resources/issuing/card_details.rb +++ b/lib/stripe/resources/issuing/card_details.rb @@ -3,7 +3,7 @@ module Stripe module Issuing class CardDetails < Stripe::StripeObject - OBJECT_NAME = "issuing.card_details".freeze + OBJECT_NAME = "issuing.card_details" end end end diff --git a/lib/stripe/resources/issuing/cardholder.rb b/lib/stripe/resources/issuing/cardholder.rb index f555798c1..9163a2180 100644 --- a/lib/stripe/resources/issuing/cardholder.rb +++ b/lib/stripe/resources/issuing/cardholder.rb @@ -7,7 +7,7 @@ class Cardholder < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "issuing.cardholder".freeze + OBJECT_NAME = "issuing.cardholder" end end end diff --git a/lib/stripe/resources/issuing/dispute.rb b/lib/stripe/resources/issuing/dispute.rb index 9cfe732b9..a7ca28197 100644 --- a/lib/stripe/resources/issuing/dispute.rb +++ b/lib/stripe/resources/issuing/dispute.rb @@ -7,7 +7,7 @@ class Dispute < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "issuing.dispute".freeze + OBJECT_NAME = "issuing.dispute" end end end diff --git a/lib/stripe/resources/issuing/transaction.rb b/lib/stripe/resources/issuing/transaction.rb index dbd29825c..e9ed28686 100644 --- a/lib/stripe/resources/issuing/transaction.rb +++ b/lib/stripe/resources/issuing/transaction.rb @@ -6,7 +6,7 @@ class Transaction < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "issuing.transaction".freeze + OBJECT_NAME = "issuing.transaction" end end end diff --git a/lib/stripe/resources/login_link.rb b/lib/stripe/resources/login_link.rb index 950e01607..2a9dee414 100644 --- a/lib/stripe/resources/login_link.rb +++ b/lib/stripe/resources/login_link.rb @@ -2,7 +2,7 @@ module Stripe class LoginLink < APIResource - OBJECT_NAME = "login_link".freeze + OBJECT_NAME = "login_link" def self.retrieve(_id, _opts = nil) raise NotImplementedError, diff --git a/lib/stripe/resources/order.rb b/lib/stripe/resources/order.rb index 19a32c333..65f52e012 100644 --- a/lib/stripe/resources/order.rb +++ b/lib/stripe/resources/order.rb @@ -6,7 +6,7 @@ class Order < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "order".freeze + OBJECT_NAME = "order" custom_method :pay, http_verb: :post custom_method :return_order, http_verb: :post, http_path: "returns" diff --git a/lib/stripe/resources/order_return.rb b/lib/stripe/resources/order_return.rb index d33df79f1..66ffcaaf4 100644 --- a/lib/stripe/resources/order_return.rb +++ b/lib/stripe/resources/order_return.rb @@ -4,6 +4,6 @@ module Stripe class OrderReturn < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "order_return".freeze + OBJECT_NAME = "order_return" end end diff --git a/lib/stripe/resources/payment_intent.rb b/lib/stripe/resources/payment_intent.rb index 5bbf8fbeb..ff1889b98 100644 --- a/lib/stripe/resources/payment_intent.rb +++ b/lib/stripe/resources/payment_intent.rb @@ -6,7 +6,7 @@ class PaymentIntent < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "payment_intent".freeze + OBJECT_NAME = "payment_intent" custom_method :cancel, http_verb: :post custom_method :capture, http_verb: :post diff --git a/lib/stripe/resources/payment_method.rb b/lib/stripe/resources/payment_method.rb index 4dd3fad15..1aa0b26dc 100644 --- a/lib/stripe/resources/payment_method.rb +++ b/lib/stripe/resources/payment_method.rb @@ -6,7 +6,7 @@ class PaymentMethod < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "payment_method".freeze + OBJECT_NAME = "payment_method" custom_method :attach, http_verb: :post custom_method :detach, http_verb: :post diff --git a/lib/stripe/resources/payout.rb b/lib/stripe/resources/payout.rb index d9e1d4800..c99b8e081 100644 --- a/lib/stripe/resources/payout.rb +++ b/lib/stripe/resources/payout.rb @@ -6,7 +6,7 @@ class Payout < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "payout".freeze + OBJECT_NAME = "payout" custom_method :cancel, http_verb: :post diff --git a/lib/stripe/resources/person.rb b/lib/stripe/resources/person.rb index 185b8d336..d7bd5fba9 100644 --- a/lib/stripe/resources/person.rb +++ b/lib/stripe/resources/person.rb @@ -5,7 +5,7 @@ class Person < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "person".freeze + OBJECT_NAME = "person" def resource_url if !respond_to?(:account) || account.nil? diff --git a/lib/stripe/resources/plan.rb b/lib/stripe/resources/plan.rb index 192bf301b..fc5da942e 100644 --- a/lib/stripe/resources/plan.rb +++ b/lib/stripe/resources/plan.rb @@ -7,6 +7,6 @@ class Plan < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "plan".freeze + OBJECT_NAME = "plan" end end diff --git a/lib/stripe/resources/product.rb b/lib/stripe/resources/product.rb index 9b318c49f..8fd952fa1 100644 --- a/lib/stripe/resources/product.rb +++ b/lib/stripe/resources/product.rb @@ -7,6 +7,6 @@ class Product < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "product".freeze + OBJECT_NAME = "product" end end diff --git a/lib/stripe/resources/radar/early_fraud_warning.rb b/lib/stripe/resources/radar/early_fraud_warning.rb index 6f53787ad..62610f8e0 100644 --- a/lib/stripe/resources/radar/early_fraud_warning.rb +++ b/lib/stripe/resources/radar/early_fraud_warning.rb @@ -5,7 +5,7 @@ module Radar class EarlyFraudWarning < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "radar.early_fraud_warning".freeze + OBJECT_NAME = "radar.early_fraud_warning" end end end diff --git a/lib/stripe/resources/radar/value_list.rb b/lib/stripe/resources/radar/value_list.rb index 2f68f09c9..5be70700f 100644 --- a/lib/stripe/resources/radar/value_list.rb +++ b/lib/stripe/resources/radar/value_list.rb @@ -8,7 +8,7 @@ class ValueList < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "radar.value_list".freeze + OBJECT_NAME = "radar.value_list" end end end diff --git a/lib/stripe/resources/radar/value_list_item.rb b/lib/stripe/resources/radar/value_list_item.rb index 6000ddd84..d1f4560e3 100644 --- a/lib/stripe/resources/radar/value_list_item.rb +++ b/lib/stripe/resources/radar/value_list_item.rb @@ -7,7 +7,7 @@ class ValueListItem < APIResource include Stripe::APIOperations::Delete extend Stripe::APIOperations::List - OBJECT_NAME = "radar.value_list_item".freeze + OBJECT_NAME = "radar.value_list_item" end end end diff --git a/lib/stripe/resources/recipient.rb b/lib/stripe/resources/recipient.rb index 9efd40714..5e95bb87c 100644 --- a/lib/stripe/resources/recipient.rb +++ b/lib/stripe/resources/recipient.rb @@ -8,7 +8,7 @@ class Recipient < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "recipient".freeze + OBJECT_NAME = "recipient" def transfers Transfer.all({ recipient: id }, @api_key) diff --git a/lib/stripe/resources/recipient_transfer.rb b/lib/stripe/resources/recipient_transfer.rb index 30faaaee3..c5ef96449 100644 --- a/lib/stripe/resources/recipient_transfer.rb +++ b/lib/stripe/resources/recipient_transfer.rb @@ -2,6 +2,6 @@ module Stripe class RecipientTransfer < StripeObject - OBJECT_NAME = "recipient_transfer".freeze + OBJECT_NAME = "recipient_transfer" end end diff --git a/lib/stripe/resources/refund.rb b/lib/stripe/resources/refund.rb index b832b0f07..518c17de5 100644 --- a/lib/stripe/resources/refund.rb +++ b/lib/stripe/resources/refund.rb @@ -6,6 +6,6 @@ class Refund < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "refund".freeze + OBJECT_NAME = "refund" end end diff --git a/lib/stripe/resources/reporting/report_run.rb b/lib/stripe/resources/reporting/report_run.rb index 25029052e..58de595ce 100644 --- a/lib/stripe/resources/reporting/report_run.rb +++ b/lib/stripe/resources/reporting/report_run.rb @@ -6,7 +6,7 @@ class ReportRun < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List - OBJECT_NAME = "reporting.report_run".freeze + OBJECT_NAME = "reporting.report_run" end end end diff --git a/lib/stripe/resources/reporting/report_type.rb b/lib/stripe/resources/reporting/report_type.rb index e13501fb3..ac6deaa3d 100644 --- a/lib/stripe/resources/reporting/report_type.rb +++ b/lib/stripe/resources/reporting/report_type.rb @@ -6,7 +6,7 @@ class ReportType < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List - OBJECT_NAME = "reporting.report_type".freeze + OBJECT_NAME = "reporting.report_type" end end end diff --git a/lib/stripe/resources/reversal.rb b/lib/stripe/resources/reversal.rb index c88809698..3af982608 100644 --- a/lib/stripe/resources/reversal.rb +++ b/lib/stripe/resources/reversal.rb @@ -5,7 +5,7 @@ class Reversal < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "transfer_reversal".freeze + OBJECT_NAME = "transfer_reversal" def resource_url "#{Transfer.resource_url}/#{CGI.escape(transfer)}/reversals" \ diff --git a/lib/stripe/resources/review.rb b/lib/stripe/resources/review.rb index 8eb0e62b6..7f51819fc 100644 --- a/lib/stripe/resources/review.rb +++ b/lib/stripe/resources/review.rb @@ -4,7 +4,7 @@ module Stripe class Review < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "review".freeze + OBJECT_NAME = "review" custom_method :approve, http_verb: :post diff --git a/lib/stripe/resources/setup_intent.rb b/lib/stripe/resources/setup_intent.rb index 3b3815fdb..cec17350a 100644 --- a/lib/stripe/resources/setup_intent.rb +++ b/lib/stripe/resources/setup_intent.rb @@ -6,7 +6,7 @@ class SetupIntent < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "setup_intent".freeze + OBJECT_NAME = "setup_intent" custom_method :cancel, http_verb: :post custom_method :confirm, http_verb: :post diff --git a/lib/stripe/resources/sigma/scheduled_query_run.rb b/lib/stripe/resources/sigma/scheduled_query_run.rb index 1ccfe1455..343a36e9a 100644 --- a/lib/stripe/resources/sigma/scheduled_query_run.rb +++ b/lib/stripe/resources/sigma/scheduled_query_run.rb @@ -5,7 +5,7 @@ module Sigma class ScheduledQueryRun < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "scheduled_query_run".freeze + OBJECT_NAME = "scheduled_query_run" def self.resource_url "/v1/sigma/scheduled_query_runs" diff --git a/lib/stripe/resources/sku.rb b/lib/stripe/resources/sku.rb index d9d20a1ff..009a751ad 100644 --- a/lib/stripe/resources/sku.rb +++ b/lib/stripe/resources/sku.rb @@ -7,6 +7,6 @@ class SKU < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "sku".freeze + OBJECT_NAME = "sku" end end diff --git a/lib/stripe/resources/source.rb b/lib/stripe/resources/source.rb index ec897b87e..805b18af5 100644 --- a/lib/stripe/resources/source.rb +++ b/lib/stripe/resources/source.rb @@ -5,7 +5,7 @@ class Source < APIResource extend Stripe::APIOperations::Create include Stripe::APIOperations::Save - OBJECT_NAME = "source".freeze + OBJECT_NAME = "source" custom_method :verify, http_verb: :post diff --git a/lib/stripe/resources/source_transaction.rb b/lib/stripe/resources/source_transaction.rb index 545162a03..1cfa3c5dd 100644 --- a/lib/stripe/resources/source_transaction.rb +++ b/lib/stripe/resources/source_transaction.rb @@ -2,6 +2,6 @@ module Stripe class SourceTransaction < StripeObject - OBJECT_NAME = "source_transaction".freeze + OBJECT_NAME = "source_transaction" end end diff --git a/lib/stripe/resources/subscription.rb b/lib/stripe/resources/subscription.rb index 0d077d44f..bbb85b887 100644 --- a/lib/stripe/resources/subscription.rb +++ b/lib/stripe/resources/subscription.rb @@ -7,7 +7,7 @@ class Subscription < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "subscription".freeze + OBJECT_NAME = "subscription" custom_method :delete_discount, http_verb: :delete, http_path: "discount" diff --git a/lib/stripe/resources/subscription_item.rb b/lib/stripe/resources/subscription_item.rb index 99bd624b7..f7bee1488 100644 --- a/lib/stripe/resources/subscription_item.rb +++ b/lib/stripe/resources/subscription_item.rb @@ -7,7 +7,7 @@ class SubscriptionItem < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "subscription_item".freeze + OBJECT_NAME = "subscription_item" def usage_record_summaries(params = {}, opts = {}) resp, opts = request(:get, resource_url + "/usage_record_summaries", params, opts) diff --git a/lib/stripe/resources/subscription_schedule.rb b/lib/stripe/resources/subscription_schedule.rb index 2c24e784d..df0499d34 100644 --- a/lib/stripe/resources/subscription_schedule.rb +++ b/lib/stripe/resources/subscription_schedule.rb @@ -7,7 +7,7 @@ class SubscriptionSchedule < APIResource include Stripe::APIOperations::Save extend Stripe::APIOperations::NestedResource - OBJECT_NAME = "subscription_schedule".freeze + OBJECT_NAME = "subscription_schedule" custom_method :cancel, http_verb: :post custom_method :release, http_verb: :post diff --git a/lib/stripe/resources/subscription_schedule_revision.rb b/lib/stripe/resources/subscription_schedule_revision.rb index e815a037d..a823dbd32 100644 --- a/lib/stripe/resources/subscription_schedule_revision.rb +++ b/lib/stripe/resources/subscription_schedule_revision.rb @@ -4,7 +4,7 @@ module Stripe class SubscriptionScheduleRevision < APIResource extend Stripe::APIOperations::List - OBJECT_NAME = "subscription_schedule_revision".freeze + OBJECT_NAME = "subscription_schedule_revision" def resource_url if !respond_to?(:schedule) || schedule.nil? diff --git a/lib/stripe/resources/tax_id.rb b/lib/stripe/resources/tax_id.rb index 7b1edc58c..2e11fc12a 100644 --- a/lib/stripe/resources/tax_id.rb +++ b/lib/stripe/resources/tax_id.rb @@ -5,7 +5,7 @@ class TaxId < APIResource include Stripe::APIOperations::Delete extend Stripe::APIOperations::List - OBJECT_NAME = "tax_id".freeze + OBJECT_NAME = "tax_id" def resource_url if !respond_to?(:customer) || customer.nil? diff --git a/lib/stripe/resources/tax_rate.rb b/lib/stripe/resources/tax_rate.rb index 9789d9b8d..4e13a140b 100644 --- a/lib/stripe/resources/tax_rate.rb +++ b/lib/stripe/resources/tax_rate.rb @@ -6,6 +6,6 @@ class TaxRate < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "tax_rate".freeze + OBJECT_NAME = "tax_rate" end end diff --git a/lib/stripe/resources/terminal/connection_token.rb b/lib/stripe/resources/terminal/connection_token.rb index 247243a0a..06aede895 100644 --- a/lib/stripe/resources/terminal/connection_token.rb +++ b/lib/stripe/resources/terminal/connection_token.rb @@ -5,7 +5,7 @@ module Terminal class ConnectionToken < APIResource extend Stripe::APIOperations::Create - OBJECT_NAME = "terminal.connection_token".freeze + OBJECT_NAME = "terminal.connection_token" end end end diff --git a/lib/stripe/resources/terminal/location.rb b/lib/stripe/resources/terminal/location.rb index 3c1beb7d4..01fb8dc91 100644 --- a/lib/stripe/resources/terminal/location.rb +++ b/lib/stripe/resources/terminal/location.rb @@ -8,7 +8,7 @@ class Location < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "terminal.location".freeze + OBJECT_NAME = "terminal.location" end end end diff --git a/lib/stripe/resources/terminal/reader.rb b/lib/stripe/resources/terminal/reader.rb index 760c74e8e..48e33bc55 100644 --- a/lib/stripe/resources/terminal/reader.rb +++ b/lib/stripe/resources/terminal/reader.rb @@ -8,7 +8,7 @@ class Reader < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "terminal.reader".freeze + OBJECT_NAME = "terminal.reader" end end end diff --git a/lib/stripe/resources/three_d_secure.rb b/lib/stripe/resources/three_d_secure.rb index e713eb0a9..ba7b260f0 100644 --- a/lib/stripe/resources/three_d_secure.rb +++ b/lib/stripe/resources/three_d_secure.rb @@ -4,7 +4,7 @@ module Stripe class ThreeDSecure < APIResource extend Stripe::APIOperations::Create - OBJECT_NAME = "three_d_secure".freeze + OBJECT_NAME = "three_d_secure" def self.resource_url "/v1/3d_secure" diff --git a/lib/stripe/resources/token.rb b/lib/stripe/resources/token.rb index acf35275c..dbd8a9e19 100644 --- a/lib/stripe/resources/token.rb +++ b/lib/stripe/resources/token.rb @@ -4,6 +4,6 @@ module Stripe class Token < APIResource extend Stripe::APIOperations::Create - OBJECT_NAME = "token".freeze + OBJECT_NAME = "token" end end diff --git a/lib/stripe/resources/topup.rb b/lib/stripe/resources/topup.rb index 5468a9c89..7b7f46976 100644 --- a/lib/stripe/resources/topup.rb +++ b/lib/stripe/resources/topup.rb @@ -6,7 +6,7 @@ class Topup < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "topup".freeze + OBJECT_NAME = "topup" custom_method :cancel, http_verb: :post diff --git a/lib/stripe/resources/transfer.rb b/lib/stripe/resources/transfer.rb index 3918a5cd4..7dccc8a8d 100644 --- a/lib/stripe/resources/transfer.rb +++ b/lib/stripe/resources/transfer.rb @@ -7,7 +7,7 @@ class Transfer < APIResource include Stripe::APIOperations::Save extend Stripe::APIOperations::NestedResource - OBJECT_NAME = "transfer".freeze + OBJECT_NAME = "transfer" custom_method :cancel, http_verb: :post diff --git a/lib/stripe/resources/usage_record.rb b/lib/stripe/resources/usage_record.rb index 9b7bffe22..1dd332a2e 100644 --- a/lib/stripe/resources/usage_record.rb +++ b/lib/stripe/resources/usage_record.rb @@ -2,7 +2,7 @@ module Stripe class UsageRecord < APIResource - OBJECT_NAME = "usage_record".freeze + OBJECT_NAME = "usage_record" def self.create(params = {}, opts = {}) unless params.key?(:subscription_item) diff --git a/lib/stripe/resources/usage_record_summary.rb b/lib/stripe/resources/usage_record_summary.rb index 9b9e515cb..621b9d2a9 100644 --- a/lib/stripe/resources/usage_record_summary.rb +++ b/lib/stripe/resources/usage_record_summary.rb @@ -2,6 +2,6 @@ module Stripe class UsageRecordSummary < StripeObject - OBJECT_NAME = "usage_record_summary".freeze + OBJECT_NAME = "usage_record_summary" end end diff --git a/lib/stripe/resources/webhook_endpoint.rb b/lib/stripe/resources/webhook_endpoint.rb index df752ec9a..cca531015 100644 --- a/lib/stripe/resources/webhook_endpoint.rb +++ b/lib/stripe/resources/webhook_endpoint.rb @@ -7,6 +7,6 @@ class WebhookEndpoint < APIResource extend Stripe::APIOperations::List include Stripe::APIOperations::Save - OBJECT_NAME = "webhook_endpoint".freeze + OBJECT_NAME = "webhook_endpoint" end end diff --git a/lib/stripe/stripe_client.rb b/lib/stripe/stripe_client.rb index 126c5d96e..fea84fb1b 100644 --- a/lib/stripe/stripe_client.rb +++ b/lib/stripe/stripe_client.rb @@ -185,19 +185,19 @@ def execute_request(method, path, "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.".freeze + "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.".freeze + "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.".freeze + "support@stripe.com." ERROR_MESSAGE_TIMEOUT_CONNECT = ( "Timed out connecting to Stripe (%s). " + diff --git a/lib/stripe/stripe_object.rb b/lib/stripe/stripe_object.rb index ea48076c5..e37b0257d 100644 --- a/lib/stripe/stripe_object.rb +++ b/lib/stripe/stripe_object.rb @@ -192,7 +192,8 @@ def as_json(*opts) def to_hash maybe_to_hash = lambda do |value| - value && value.respond_to?(:to_hash) ? value.to_hash : value + return nil if value.nil? + value.respond_to?(:to_hash) ? value.to_hash : value end @values.each_with_object({}) do |(key, value), acc| diff --git a/lib/stripe/util.rb b/lib/stripe/util.rb index e4036b8f1..49c3d38d1 100644 --- a/lib/stripe/util.rb +++ b/lib/stripe/util.rb @@ -277,10 +277,7 @@ def self.level_name(level) end private_class_method :level_name - # TODO: Make these named required arguments when we drop support for Ruby - # 2.0. - def self.log_internal(message, data = {}, color: nil, level: nil, - logger: nil, out: nil) + def self.log_internal(message, data = {}, color:, level:, logger:, out:) data_str = data.reject { |_k, v| v.nil? } .map do |(k, v)| format("%s=%s", diff --git a/lib/stripe/version.rb b/lib/stripe/version.rb index d742b9bba..361d98f5e 100644 --- a/lib/stripe/version.rb +++ b/lib/stripe/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Stripe - VERSION = "4.21.3".freeze + VERSION = "4.21.3" end diff --git a/lib/stripe/webhook.rb b/lib/stripe/webhook.rb index 5aea9490a..ef06ccafa 100644 --- a/lib/stripe/webhook.rb +++ b/lib/stripe/webhook.rb @@ -22,7 +22,7 @@ def self.construct_event(payload, sig_header, secret, end module Signature - EXPECTED_SCHEME = "v1".freeze + EXPECTED_SCHEME = "v1" def self.compute_signature(payload, secret) OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha256"), secret, payload) diff --git a/stripe.gemspec b/stripe.gemspec index 126ca5732..63172b493 100644 --- a/stripe.gemspec +++ b/stripe.gemspec @@ -7,7 +7,7 @@ require "stripe/version" Gem::Specification.new do |s| s.name = "stripe" s.version = Stripe::VERSION - s.required_ruby_version = ">= 2.1.0" + s.required_ruby_version = ">= 2.3.0" s.summary = "Ruby bindings for the Stripe API" s.description = "Stripe is the easiest way to accept payments online. " \ "See https://stripe.com for details." diff --git a/test/stripe/api_operations_test.rb b/test/stripe/api_operations_test.rb index fa6b8d9bd..5d2954ae8 100644 --- a/test/stripe/api_operations_test.rb +++ b/test/stripe/api_operations_test.rb @@ -7,7 +7,7 @@ class ApiOperationsTest < Test::Unit::TestCase class UpdateableResource < APIResource include Stripe::APIOperations::Save - OBJECT_NAME = "updateableresource".freeze + OBJECT_NAME = "updateableresource" def self.protected_fields [:protected] @@ -34,7 +34,7 @@ def self.protected_fields context ".nested_resource_class_methods" do class MainResource < APIResource extend Stripe::APIOperations::NestedResource - OBJECT_NAME = "mainresource".freeze + OBJECT_NAME = "mainresource" nested_resource_class_methods :nested, operations: %i[create retrieve update delete list] end diff --git a/test/stripe/api_resource_test.rb b/test/stripe/api_resource_test.rb index 7d9c47e7e..85cfcd742 100644 --- a/test/stripe/api_resource_test.rb +++ b/test/stripe/api_resource_test.rb @@ -5,7 +5,7 @@ module Stripe class ApiResourceTest < Test::Unit::TestCase class CustomMethodAPIResource < APIResource - OBJECT_NAME = "custom_method".freeze + OBJECT_NAME = "custom_method" custom_method :my_method, http_verb: :post end diff --git a/test/stripe/multipart_encoder_test.rb b/test/stripe/multipart_encoder_test.rb index bbb0bc7d5..10eb4df32 100644 --- a/test/stripe/multipart_encoder_test.rb +++ b/test/stripe/multipart_encoder_test.rb @@ -18,17 +18,17 @@ class MultipartEncoderTest < Test::Unit::TestCase encoder.close body = encoder.body - assert_equal <<-BODY.rstrip, body ---#{encoder.boundary}\r -Content-Disposition: form-data; name="file"; filename="#{::File.basename(f.path)}"\r -Content-Type: application/octet-stream\r -\r -file-content\r ---#{encoder.boundary}\r -Content-Disposition: form-data; name="other_param"\r -\r -other-param-content\r ---#{encoder.boundary}-- + assert_equal <<~BODY.rstrip, body + --#{encoder.boundary}\r + Content-Disposition: form-data; name="file"; filename="#{::File.basename(f.path)}"\r + Content-Type: application/octet-stream\r + \r + file-content\r + --#{encoder.boundary}\r + Content-Disposition: form-data; name="other_param"\r + \r + other-param-content\r + --#{encoder.boundary}-- BODY end end @@ -47,13 +47,13 @@ def read encoder.close body = encoder.body - assert_equal <<-BODY.rstrip, body ---#{encoder.boundary}\r -Content-Disposition: form-data; name="file_like"; filename="blob"\r -Content-Type: application/octet-stream\r -\r -klass-read-content\r ---#{encoder.boundary}-- + assert_equal <<~BODY.rstrip, body + --#{encoder.boundary}\r + Content-Disposition: form-data; name="file_like"; filename="blob"\r + Content-Type: application/octet-stream\r + \r + klass-read-content\r + --#{encoder.boundary}-- BODY end @@ -65,12 +65,12 @@ def read encoder.close body = encoder.body - assert_equal <<-BODY.rstrip, body ---#{encoder.boundary}\r -Content-Disposition: form-data; name="%22quoted %22"\r -\r -content\r ---#{encoder.boundary}-- + assert_equal <<~BODY.rstrip, body + --#{encoder.boundary}\r + Content-Disposition: form-data; name="%22quoted %22"\r + \r + content\r + --#{encoder.boundary}-- BODY end diff --git a/test/stripe/payment_intent_test.rb b/test/stripe/payment_intent_test.rb index ef17b7857..d5832334a 100644 --- a/test/stripe/payment_intent_test.rb +++ b/test/stripe/payment_intent_test.rb @@ -4,7 +4,7 @@ module Stripe class PaymentIntentTest < Test::Unit::TestCase - TEST_RESOURCE_ID = "pi_123".freeze + TEST_RESOURCE_ID = "pi_123" should "be listable" do payment_intents = Stripe::PaymentIntent.list diff --git a/test/stripe/setup_intent_test.rb b/test/stripe/setup_intent_test.rb index 84044157f..4ce3eafcb 100644 --- a/test/stripe/setup_intent_test.rb +++ b/test/stripe/setup_intent_test.rb @@ -4,7 +4,7 @@ module Stripe class SetupIntentTest < Test::Unit::TestCase - TEST_RESOURCE_ID = "seti_123".freeze + TEST_RESOURCE_ID = "seti_123" should "be listable" do setup_intents = Stripe::SetupIntent.list diff --git a/test/stripe/stripe_object_test.rb b/test/stripe/stripe_object_test.rb index 57d38050a..3bb44e800 100644 --- a/test/stripe/stripe_object_test.rb +++ b/test/stripe/stripe_object_test.rb @@ -52,9 +52,9 @@ class StripeObjectTest < Test::Unit::TestCase 2, ], map: { - :"0" => StripeObject.construct_from({ id: "index0" }, opts), - :"1" => "index1", - :"2" => 2, + "0": StripeObject.construct_from({ id: "index0" }, opts), + "1": "index1", + "2": 2, }, } diff --git a/test/stripe/webhook_test.rb b/test/stripe/webhook_test.rb index 3c8431939..42ed1258e 100644 --- a/test/stripe/webhook_test.rb +++ b/test/stripe/webhook_test.rb @@ -4,13 +4,13 @@ module Stripe class WebhookTest < Test::Unit::TestCase - EVENT_PAYLOAD = <<-PAYLOAD.freeze + EVENT_PAYLOAD = <<~PAYLOAD { "id": "evt_test_webhook", "object": "event" } PAYLOAD - SECRET = "whsec_test_secret".freeze + SECRET = "whsec_test_secret" def generate_header(opts = {}) opts[:timestamp] ||= Time.now.to_i diff --git a/test/stripe_mock.rb b/test/stripe_mock.rb index 49b742e4a..9118f119c 100644 --- a/test/stripe_mock.rb +++ b/test/stripe_mock.rb @@ -4,8 +4,8 @@ module Stripe class StripeMock include Singleton - PATH_SPEC = "#{::File.dirname(__FILE__)}/openapi/spec3.json".freeze - PATH_FIXTURES = "#{::File.dirname(__FILE__)}/openapi/fixtures3.json".freeze + PATH_SPEC = "#{::File.dirname(__FILE__)}/openapi/spec3.json" + PATH_FIXTURES = "#{::File.dirname(__FILE__)}/openapi/fixtures3.json" @pid = nil @port = -1 diff --git a/test/test_helper.rb b/test/test_helper.rb index a40e9b1b2..b18a7b3b3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -17,7 +17,7 @@ require ::File.expand_path("stripe_mock", __dir__) # If changing this number, please also change it in `.travis.yml`. -MOCK_MINIMUM_VERSION = "0.60.0".freeze +MOCK_MINIMUM_VERSION = "0.60.0" MOCK_PORT = Stripe::StripeMock.start # Disable all real network connections except those that are outgoing to