Skip to content

Commit

Permalink
Merge pull request #649 from stripe/brandur-frozen-strings
Browse files Browse the repository at this point in the history
Add `frozen_string_literal` to every file and enforce Rubocop rule
  • Loading branch information
brandur-stripe authored May 10, 2018
2 parents 40e4883 + 863da48 commit ec66c3f
Show file tree
Hide file tree
Showing 124 changed files with 248 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Layout/IndentArray:
Layout/IndentHash:
EnforcedStyle: consistent

Style/FrozenStringLiteralComment:
EnforcedStyle: always

Style/StringLiterals:
EnforcedStyle: double_quotes

Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rake/testtask"
require "rubocop/rake_task"

Expand Down
2 changes: 2 additions & 0 deletions bin/stripe-console
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

require "irb"
require "irb/completion"

Expand Down
2 changes: 2 additions & 0 deletions lib/stripe.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Stripe Ruby bindings
# API spec at https://stripe.com/docs/api
require "cgi"
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/account.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Account < APIResource
extend Gem::Deprecate
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/alipay_account.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class AlipayAccount < APIResource
include Stripe::APIOperations::Save
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/api_operations/create.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
module APIOperations
module Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/api_operations/delete.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
module APIOperations
module Delete
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/api_operations/list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
module APIOperations
module List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/api_operations/nested_resource.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
module APIOperations
# Adds methods to help manipulate a subresource from its parent resource so
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/api_operations/request.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
module APIOperations
module Request
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/api_operations/save.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
module APIOperations
module Save
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/api_resource.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class APIResource < StripeObject
include Stripe::APIOperations::Request
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/apple_pay_domain.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
# Domains registered for Apple Pay on the Web
class ApplePayDomain < APIResource
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/application_fee.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class ApplicationFee < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/application_fee_refund.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class ApplicationFeeRefund < APIResource
include Stripe::APIOperations::Save
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/balance.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Balance < SingletonAPIResource
OBJECT_NAME = "balance".freeze
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/balance_transaction.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class BalanceTransaction < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/bank_account.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class BankAccount < APIResource
include Stripe::APIOperations::Save
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/bitcoin_receiver.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class BitcoinReceiver < APIResource
# Directly creating or retrieving BitcoinReceivers is deprecated. Please use
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/bitcoin_transaction.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class BitcoinTransaction < APIResource
# Directly retrieving BitcoinTransactions is deprecated. Please use the
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/card.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Card < APIResource
include Stripe::APIOperations::Save
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/charge.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Charge < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/country_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class CountrySpec < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/coupon.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Coupon < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/customer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Customer < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/dispute.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Dispute < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/ephemeral_key.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class EphemeralKey < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/errors.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
# StripeError is the base error from which all other more specific Stripe
# errors derive.
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/event.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Event < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/exchange_rate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class ExchangeRate < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/file_upload.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class FileUpload < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/invoice.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Invoice < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/invoice_item.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class InvoiceItem < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/invoice_line_item.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class InvoiceLineItem < StripeObject
OBJECT_NAME = "line_item".freeze
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/issuer_fraud_record.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class IssuerFraudRecord < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/list_object.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class ListObject < StripeObject
include Enumerable
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/login_link.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class LoginLink < APIResource
OBJECT_NAME = "login_link".freeze
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/oauth.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
module OAuth
module OAuthOperations
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/order.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Order < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/order_return.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class OrderReturn < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/payout.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Payout < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/plan.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Plan < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/product.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Product < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/recipient.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
# Recipients objects are deprecated. Please use Stripe Connect instead.
class Recipient < APIResource
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/recipient_transfer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class RecipientTransfer < StripeObject
OBJECT_NAME = "recipient_transfer".freeze
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/refund.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Refund < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/reversal.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Reversal < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/singleton_api_resource.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class SingletonAPIResource < APIResource
def self.resource_url
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/sku.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class SKU < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/source.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Source < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/source_transaction.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class SourceTransaction < StripeObject
OBJECT_NAME = "source_transaction".freeze
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/stripe_client.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/stripe_object.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class StripeObject
include Enumerable
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/stripe_response.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
# StripeResponse encapsulates some vitals of a response that came back from
# the Stripe API.
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/subscription.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Subscription < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/subscription_item.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class SubscriptionItem < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/three_d_secure.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class ThreeDSecure < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/token.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Token < APIResource
extend Stripe::APIOperations::Create
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/topup.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Topup < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/transfer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class Transfer < APIResource
extend Stripe::APIOperations::List
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/usage_record.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
class UsageRecord < APIResource
def self.create(params = {}, opts = {})
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/util.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "cgi"

module Stripe
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Stripe
VERSION = "3.14.0".freeze
end
Loading

0 comments on commit ec66c3f

Please sign in to comment.