Give code a little breathing room

This commit is contained in:
Brandur 2015-10-23 16:25:33 -07:00
parent 216218aeb0
commit 1182539ae4

View File

@ -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