mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-27 00:03:06 -05:00
Add a helper to add a beta version (#1343)
* Add a helper to add a beta header * Typo
This commit is contained in:
parent
d249b5f78b
commit
418d79de1b
@ -121,6 +121,14 @@ module Stripe
|
||||
}
|
||||
end
|
||||
|
||||
def self.add_beta_version(beta_name, version)
|
||||
if api_version.include?("; #{beta_name}=")
|
||||
raise "Stripe version header #{api_version} already contains entry for beta #{beta_name}"
|
||||
end
|
||||
|
||||
self.api_version = "#{api_version}; #{beta_name}=#{version}"
|
||||
end
|
||||
|
||||
class Preview
|
||||
def self._get_default_opts(opts)
|
||||
{ api_mode: :preview }.merge(opts)
|
||||
|
||||
@ -119,6 +119,18 @@ class StripeTest < Test::Unit::TestCase
|
||||
assert_equal "2018-02-28", Stripe.api_version
|
||||
end
|
||||
|
||||
should "allow beta versions to be added once only" do
|
||||
Stripe.api_version = "2018-02-28"
|
||||
|
||||
Stripe.add_beta_version("my_beta", "v2")
|
||||
assert_equal "2018-02-28; my_beta=v2", Stripe.api_version
|
||||
|
||||
err = assert_raises do
|
||||
Stripe.add_beta_version("my_beta", "v1")
|
||||
assert_equal(err, "Stripe version header 2018-02-28; my_beta=v2 already contains entry for beta my_beta")
|
||||
end
|
||||
end
|
||||
|
||||
should "allow connect_base to be configured" do
|
||||
Stripe.connect_base = "https://other.stripe.com"
|
||||
assert_equal "https://other.stripe.com", Stripe.connect_base
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user