mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-04 00:00:47 -04:00
Give code a little breathing room
This commit is contained in:
parent
216218aeb0
commit
1182539ae4
@ -16,14 +16,16 @@ module Stripe
|
||||
# @override To make id optional
|
||||
def self.retrieve(id=ARGUMENT_NOT_PROVIDED, opts={})
|
||||
id = id.equal?(ARGUMENT_NOT_PROVIDED) ? nil : Util.check_string_argument!(id)
|
||||
# Account used to be a singleton, where this method's signature was `(opts={})`.
|
||||
# For the sake of not breaking folks who pass in an OAuth key in opts, let's lurkily
|
||||
# string match for it.
|
||||
|
||||
# Account used to be a singleton, where this method's signature was
|
||||
# `(opts={})`. For the sake of not breaking folks who pass in an OAuth
|
||||
# key in opts, let's lurkily string match for it.
|
||||
if opts == {} && id.is_a?(String) && id.start_with?('sk_')
|
||||
# `super` properly assumes a String opts is the apiKey and normalizes as expected.
|
||||
opts = id
|
||||
id = nil
|
||||
end
|
||||
|
||||
super(id, opts)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user