mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-08-10 00:01:09 -04:00
Add frozen_string_literal
to every file and enforce Rubocop rule
Adds the magic `frozen_string_literal: true` comment to every file and enables a Rubocop rule to make sure that it's always going to be there going forward as well. See here for more background [1], but the basic idea is that unlike many other languages, static strings in code are mutable by default. This has since been acknowledged as not a particularly good idea, and the intention is to rectify the mistake when Ruby 3 comes out, where all string literals will be frozen. The `frozen_string_literal` magic comment was introduced in Ruby 2.3 as a way of easing the transition, and allows libraries and projects to freeze their literals in advance. I don't think this is breaking in any way: it's possible that users might've been pulling out one of are literals somehow and mutating it, but that would probably not have been useful for anything and would certainly not be recommended, so I'm quite comfortable pushing this change through as a minor version. As discussed in #641. [1] https://stackoverflow.com/a/37799399
This commit is contained in:
parent
40e4883ddc
commit
863da48398
@ -13,6 +13,9 @@ Layout/IndentArray:
|
||||
Layout/IndentHash:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
EnforcedStyle: always
|
||||
|
||||
Style/StringLiterals:
|
||||
EnforcedStyle: double_quotes
|
||||
|
||||
|
2
Gemfile
2
Gemfile
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec
|
||||
|
2
Rakefile
2
Rakefile
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rake/testtask"
|
||||
require "rubocop/rake_task"
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "irb"
|
||||
require "irb/completion"
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Stripe Ruby bindings
|
||||
# API spec at https://stripe.com/docs/api
|
||||
require "cgi"
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Account < APIResource
|
||||
extend Gem::Deprecate
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class AlipayAccount < APIResource
|
||||
include Stripe::APIOperations::Save
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module Delete
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
# Adds methods to help manipulate a subresource from its parent resource so
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module Request
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module Save
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class APIResource < StripeObject
|
||||
include Stripe::APIOperations::Request
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Domains registered for Apple Pay on the Web
|
||||
class ApplePayDomain < APIResource
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class ApplicationFee < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class ApplicationFeeRefund < APIResource
|
||||
include Stripe::APIOperations::Save
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Balance < SingletonAPIResource
|
||||
OBJECT_NAME = "balance".freeze
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class BalanceTransaction < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class BankAccount < APIResource
|
||||
include Stripe::APIOperations::Save
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class BitcoinReceiver < APIResource
|
||||
# Directly creating or retrieving BitcoinReceivers is deprecated. Please use
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class BitcoinTransaction < APIResource
|
||||
# Directly retrieving BitcoinTransactions is deprecated. Please use the
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Card < APIResource
|
||||
include Stripe::APIOperations::Save
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Charge < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class CountrySpec < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Coupon < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Customer < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Dispute < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class EphemeralKey < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# StripeError is the base error from which all other more specific Stripe
|
||||
# errors derive.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Event < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class ExchangeRate < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class FileUpload < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Invoice < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class InvoiceItem < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class InvoiceLineItem < StripeObject
|
||||
OBJECT_NAME = "line_item".freeze
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class IssuerFraudRecord < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class ListObject < StripeObject
|
||||
include Enumerable
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class LoginLink < APIResource
|
||||
OBJECT_NAME = "login_link".freeze
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module OAuth
|
||||
module OAuthOperations
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Order < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class OrderReturn < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Payout < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Plan < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Product < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Recipients objects are deprecated. Please use Stripe Connect instead.
|
||||
class Recipient < APIResource
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class RecipientTransfer < StripeObject
|
||||
OBJECT_NAME = "recipient_transfer".freeze
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Refund < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Reversal < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class SingletonAPIResource < APIResource
|
||||
def self.resource_url
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class SKU < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Source < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class SourceTransaction < StripeObject
|
||||
OBJECT_NAME = "source_transaction".freeze
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# StripeClient executes requests against the Stripe API and allows a user to
|
||||
# recover both a resource a call returns as well as a response object that
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class StripeObject
|
||||
include Enumerable
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# StripeResponse encapsulates some vitals of a response that came back from
|
||||
# the Stripe API.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Subscription < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class SubscriptionItem < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class ThreeDSecure < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Token < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Topup < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Transfer < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class UsageRecord < APIResource
|
||||
def self.create(params = {}, opts = {})
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cgi"
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
VERSION = "3.14.0".freeze
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Webhook
|
||||
DEFAULT_TOLERANCE = 300
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
||||
|
||||
require "stripe/version"
|
||||
|
@ -0,0 +1 @@
|
||||
# frozen_string_literal: true
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,4 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,4 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user