lib/stripe/util.rb in stripe-13.0.2 vs lib/stripe/util.rb in stripe-13.1.0.pre.beta.2
- old
+ new
@@ -298,10 +298,16 @@
def self.normalize_opts(opts)
case opts
when String
{ api_key: opts }
when Hash
- check_api_key!(opts.fetch(:api_key)) if opts.key?(:api_key)
+ # If the user is using request signing for authentication,
+ # no need to check the api_key per request.
+ if !(opts.key?(:client) &&
+ opts.fetch(:client).config.authenticator) &&
+ opts.key?(:api_key)
+ check_api_key!(opts.fetch(:api_key))
+ end
# Explicitly use dup here instead of clone to avoid preserving freeze
# state on input params.
opts.dup
else
raise TypeError, "normalize_opts expects a string or a hash"