From 4df245996b2d1cd39bac18b30387d53fe763f8cb Mon Sep 17 00:00:00 2001 From: Sheena Pakanati Date: Tue, 15 Jan 2013 11:31:03 -0800 Subject: [PATCH 1/2] Add support for setting API version. --- lib/stripe.rb | 14 ++++++++++++++ lib/stripe/version.rb | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/stripe.rb b/lib/stripe.rb index 3800fbc3..66d36a46 100644 --- a/lib/stripe.rb +++ b/lib/stripe.rb @@ -49,6 +49,7 @@ module Stripe @@api_key = nil @@api_base = 'https://api.stripe.com' @@verify_ssl_certs = true + @@api_version = nil def self.api_url(url='') @@api_base + url @@ -78,6 +79,14 @@ module Stripe @@verify_ssl_certs end + def self.api_version=(version) + @@api_version = version + end + + def self.api_version + @@api_version + end + def self.request(method, url, api_key, params={}, headers={}) api_key ||= @@api_key raise AuthenticationError.new('No API key provided. (HINT: set your API key using "Stripe.api_key = ". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions.)') unless api_key @@ -139,6 +148,11 @@ module Stripe :authorization => "Bearer #{api_key}", :content_type => 'application/x-www-form-urlencoded' }.merge(headers) + + if self.api_version + headers[:stripe_version] = self.api_version + end + opts = { :method => method, :url => url, diff --git a/lib/stripe/version.rb b/lib/stripe/version.rb index cfb608ff..41cbd098 100644 --- a/lib/stripe/version.rb +++ b/lib/stripe/version.rb @@ -1,3 +1,3 @@ module Stripe - VERSION = '1.7.8' + VERSION = '1.7.9' end From 4dca4320d86b1d7b1aa03e0494c30dc24ebc8435 Mon Sep 17 00:00:00 2001 From: Sheena Pakanati Date: Tue, 15 Jan 2013 11:31:23 -0800 Subject: [PATCH 2/2] Bump version to 1.7.9. --- History.txt | 3 +++ VERSION | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/History.txt b/History.txt index ea298ccc..b4525b99 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,6 @@ +=== 1.7.9 2013-01-15 +* Add support for setting a Stripe API version override. + === 1.7.8 2012-11-21 * Relax the version constraint on multi_json (github issue #44) diff --git a/VERSION b/VERSION index 84298f96..f65dc1e2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7.8 +1.7.9