mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-06-02 00:00:35 -04:00
Merge remote-tracking branch 'origin/master' into beta
This commit is contained in:
commit
8c0015fb2c
195
.rubocop.yml
195
.rubocop.yml
@ -74,3 +74,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
|
||||
|
@ -1,33 +1,82 @@
|
||||
# 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-29 18:39:02 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: 27
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
Max: 51
|
||||
Max: 55
|
||||
|
||||
# Offense count: 12
|
||||
# Configuration parameters: CountComments.
|
||||
# Offense count: 10
|
||||
# Configuration parameters: CountComments, CountAsOne.
|
||||
Metrics/ClassLength:
|
||||
Max: 694
|
||||
Max: 618
|
||||
|
||||
# Offense count: 12
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 15
|
||||
Max: 12
|
||||
|
||||
# Offense count: 6
|
||||
# Configuration parameters: CountKeywordArgs.
|
||||
Metrics/ParameterLists:
|
||||
Max: 7
|
||||
|
||||
# Offense count: 8
|
||||
# Offense count: 9
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 17
|
||||
Max: 13
|
||||
|
||||
# Offense count: 86
|
||||
# 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: 44
|
||||
# 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'
|
||||
|
7
Gemfile
7
Gemfile
@ -23,10 +23,13 @@ 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"
|
||||
#
|
||||
# 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"
|
||||
# don't install on truffleruby
|
||||
gem "jaro_winkler", "1.5.4" unless RUBY_ENGINE == "truffleruby"
|
||||
|
||||
platforms :mri do
|
||||
gem "byebug"
|
||||
|
10
Rakefile
10
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
|
||||
@ -17,7 +19,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,7 +27,7 @@ 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" \
|
||||
|
@ -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
|
||||
|
@ -103,9 +103,7 @@ module Stripe
|
||||
|
||||
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
|
||||
|
@ -19,9 +19,7 @@ module Stripe
|
||||
# {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 @@ module Stripe
|
||||
|
||||
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)
|
||||
|
||||
@ -72,8 +70,8 @@ module Stripe
|
||||
initialize_from(resp.data, opts)
|
||||
end
|
||||
extend Gem::Deprecate
|
||||
deprecate :save, "the `update` class method (for examples"\
|
||||
" see https://github.com/stripe/stripe-ruby"\
|
||||
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)
|
||||
|
@ -31,7 +31,7 @@ module Stripe
|
||||
end
|
||||
|
||||
def self.resource_url
|
||||
"/v1/test_helpers/"\
|
||||
"/v1/test_helpers/" \
|
||||
"#{self::RESOURCE_CLASS::OBJECT_NAME.downcase.tr('.', '/')}s"
|
||||
end
|
||||
|
||||
|
@ -157,9 +157,7 @@ module Stripe
|
||||
|
||||
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"
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 @@ module Stripe
|
||||
|
||||
# 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 @@ module Stripe
|
||||
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 @@ module Stripe
|
||||
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
|
||||
|
@ -106,22 +106,22 @@ module Stripe
|
||||
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"
|
||||
|
@ -13,12 +13,8 @@ module Stripe
|
||||
attr_reader :auth_token, :sign_lambda
|
||||
|
||||
def initialize(auth_token, sign_lambda)
|
||||
unless auth_token.is_a?(String)
|
||||
raise ArgumentError, "auth_token must be a string"
|
||||
end
|
||||
unless sign_lambda.is_a?(Proc)
|
||||
raise ArgumentError, "sign_lambda must be a lambda"
|
||||
end
|
||||
raise ArgumentError, "auth_token must be a string" unless auth_token.is_a?(String)
|
||||
raise ArgumentError, "sign_lambda must be a lambda" unless sign_lambda.is_a?(Proc)
|
||||
|
||||
@auth_token = auth_token
|
||||
@sign_lambda = sign_lambda
|
||||
@ -68,7 +64,7 @@ module Stripe
|
||||
private def encoded_signature(signature_base)
|
||||
Base64.strict_encode64(sign(signature_base))
|
||||
rescue StandardError
|
||||
raise AuthenticationError, "Encountered '#{e.message} (#{e.class})' "\
|
||||
raise AuthenticationError, "Encountered '#{e.message} (#{e.class})' " \
|
||||
"when calculating request signature."
|
||||
end
|
||||
|
||||
|
@ -123,18 +123,14 @@ module Stripe
|
||||
end
|
||||
|
||||
def serialize_params_account(_obj, update_hash, options = {})
|
||||
if (entity = @values[:legal_entity])
|
||||
if (owners = entity[:additional_owners])
|
||||
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
|
||||
end
|
||||
if (individual = @values[:individual])
|
||||
if individual.is_a?(Person) && !update_hash.key?(:individual)
|
||||
if (individual = @values[:individual]) && (individual.is_a?(Person) && !update_hash.key?(:individual))
|
||||
update_hash[:individual] = individual.serialize_params(options)
|
||||
end
|
||||
end
|
||||
update_hash
|
||||
end
|
||||
|
||||
|
@ -32,7 +32,7 @@ module Stripe
|
||||
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 " \
|
||||
"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)`"
|
||||
|
@ -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
|
||||
|
@ -26,11 +26,9 @@ module Stripe
|
||||
end
|
||||
|
||||
def self.create(params = {}, opts = {})
|
||||
if params[:file] && !params[:file].is_a?(String)
|
||||
unless params[:file].respond_to?(:read)
|
||||
if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
|
||||
raise ArgumentError, "file must respond to `#read`"
|
||||
end
|
||||
end
|
||||
|
||||
config = opts[:client]&.config || Stripe.config
|
||||
opts = {
|
||||
|
@ -36,8 +36,7 @@ module Stripe
|
||||
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 @@ module Stripe
|
||||
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 @@ module Stripe
|
||||
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
|
||||
@ -496,9 +493,7 @@ module Stripe
|
||||
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
|
||||
|
||||
@ -571,14 +566,14 @@ module Stripe
|
||||
body = Util.encode_parameters(body_params)
|
||||
end
|
||||
|
||||
if api_mode == :preview
|
||||
body_log = body
|
||||
body_log = if api_mode == :preview
|
||||
body
|
||||
else
|
||||
# We don't use `Util.encode_parameters` partly as an optimization (to
|
||||
# not redo work we've already done), and partly because the encoded
|
||||
# forms of certain characters introduce a lot of visual noise and it's
|
||||
# nice to have a clearer format for logs.
|
||||
body_log = flattened_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
||||
flattened_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
||||
end
|
||||
|
||||
[body, body_log]
|
||||
@ -605,9 +600,7 @@ module Stripe
|
||||
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,
|
||||
@ -657,7 +650,7 @@ module Stripe
|
||||
|
||||
# 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
|
||||
@ -882,9 +875,7 @@ module Stripe
|
||||
|
||||
private def request_headers(api_key, method, api_mode)
|
||||
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,
|
||||
@ -996,16 +987,8 @@ module Stripe
|
||||
# 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 :authenticator
|
||||
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, :authenticator, :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
|
||||
|
@ -25,27 +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 :authenticator
|
||||
attr_accessor :client_id
|
||||
attr_accessor :enable_telemetry
|
||||
attr_accessor :logger
|
||||
attr_accessor :stripe_account
|
||||
attr_accessor :api_key, :api_version, :authenticator, :client_id, :enable_telemetry, :logger, :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_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|
|
||||
@ -97,8 +82,8 @@ module Stripe
|
||||
|
||||
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
|
||||
@ -126,9 +111,7 @@ module Stripe
|
||||
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)
|
||||
|
@ -359,9 +359,7 @@ module Stripe
|
||||
@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 @@ module Stripe
|
||||
# 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?("=")
|
||||
@ -411,10 +408,8 @@ module Stripe
|
||||
"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 @@ module Stripe
|
||||
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?
|
||||
""
|
||||
@ -535,6 +531,7 @@ module Stripe
|
||||
value
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics/PerceivedComplexity
|
||||
|
||||
# Produces a deep copy of the given object including support for arrays,
|
||||
# hashes, and StripeObjects.
|
||||
|
@ -41,9 +41,7 @@ module Stripe
|
||||
|
||||
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
|
||||
|
@ -80,8 +80,8 @@ module Stripe
|
||||
"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(
|
||||
@ -140,9 +140,7 @@ module Stripe
|
||||
|
||||
# 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
|
||||
@ -154,7 +152,7 @@ module Stripe
|
||||
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
|
||||
@ -164,7 +162,7 @@ module Stripe
|
||||
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
|
||||
@ -174,7 +172,7 @@ module Stripe
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 @@ module Stripe
|
||||
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" },
|
||||
|
@ -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 @@ module Stripe
|
||||
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,
|
||||
|
@ -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
|
||||
@ -591,7 +591,7 @@ module Stripe
|
||||
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(
|
||||
@ -668,7 +668,7 @@ module Stripe
|
||||
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(
|
||||
@ -720,7 +720,7 @@ module Stripe
|
||||
end
|
||||
|
||||
context "test helpers" do
|
||||
class TestHelperAPIResource < APIResource
|
||||
class TestHelperAPIResource < APIResource # rubocop:todo Lint/ConstantDefinitionInBlock
|
||||
OBJECT_NAME = "hello"
|
||||
|
||||
def test_helpers
|
||||
|
@ -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 @@ module Stripe
|
||||
assert domain.is_a?(Stripe::ApplePayDomain)
|
||||
end
|
||||
|
||||
should "be deletable" do
|
||||
should "be deletable" do # rubocop:todo Lint/EmptyBlock
|
||||
end
|
||||
|
||||
context "#delete" do
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 @@ module Stripe
|
||||
"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",
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require ::File.expand_path("../test_helper", __dir__)
|
||||
require File.expand_path("../test_helper", __dir__)
|
||||
|
||||
class PreviewTest < Test::Unit::TestCase
|
||||
context "preview raw requests" do
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 @@ module Stripe
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require ::File.expand_path("../test_helper", __dir__)
|
||||
require File.expand_path("../test_helper", __dir__)
|
||||
|
||||
class RawRequestTest < Test::Unit::TestCase
|
||||
context "raw_request" do
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 RequestSigningAuthenticatorTest < Test::Unit::TestCase
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 @@ module Stripe
|
||||
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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 @@ module Stripe
|
||||
%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
|
||||
@ -555,7 +553,7 @@ module Stripe
|
||||
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
|
||||
@ -569,7 +567,7 @@ module Stripe
|
||||
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
|
||||
@ -609,7 +607,7 @@ module Stripe
|
||||
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
|
||||
@ -856,7 +854,7 @@ module Stripe
|
||||
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
|
||||
@ -1300,7 +1298,7 @@ module Stripe
|
||||
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
|
||||
@ -1393,7 +1391,7 @@ module Stripe
|
||||
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
|
||||
@ -1409,7 +1407,7 @@ module Stripe
|
||||
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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 @@ module Stripe
|
||||
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 @@ module Stripe
|
||||
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
|
||||
|
||||
@ -434,7 +434,7 @@ module Stripe
|
||||
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!
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
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