mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-09-22 00:00:31 -04:00
Merge remote-tracking branch 'origin/master' into nested-to-hash
This commit is contained in:
commit
5502c58162
125
History.txt
125
History.txt
@ -1,18 +1,32 @@
|
||||
=== 1.10.2 2014-02-18
|
||||
|
||||
* 1 minor enhancement:
|
||||
* Add create_subscription on Customer resources, so you can create
|
||||
subscriptions without needing to retrieve the customer first (github
|
||||
issue #120)
|
||||
|
||||
=== 1.10.1 2014-02-03
|
||||
|
||||
* Fix marshaling of StripeObjects
|
||||
* 1 bugfix:
|
||||
* Fix marshaling of StripeObjects
|
||||
|
||||
=== 1.10.0 2014-01-29
|
||||
|
||||
* Support for multiple subscriptions per customer
|
||||
* Allow #save to take opts (for :expand)
|
||||
* Testing ruby 2.1.0
|
||||
* Replace multi_json with json
|
||||
* Fix #try and #respond_to? on StripeObjects
|
||||
* 2 major enhancements
|
||||
* Support for multiple subscriptions per customer
|
||||
* Testing ruby 2.1.0
|
||||
|
||||
* 2 minor enhancements
|
||||
* Replace multi_json with json
|
||||
* Allow #save to take opts (for :expand)
|
||||
|
||||
* 1 bugfix
|
||||
* Fix #try and #respond_to? on StripeObjects
|
||||
|
||||
=== 1.9.9 2013-12-02
|
||||
|
||||
* Add ApplicationFee API resource
|
||||
* 1 major enhancement
|
||||
* Add ApplicationFee resource
|
||||
|
||||
=== 1.8.9 2013-11-14
|
||||
|
||||
@ -22,26 +36,31 @@
|
||||
|
||||
=== 1.8.8 2013-10-3
|
||||
|
||||
* Add support for metadata API
|
||||
* 1 major enhancement
|
||||
* Add support for metadata on resources
|
||||
|
||||
=== 1.8.7 2013-08-18
|
||||
|
||||
* Add support for closing disputes.
|
||||
* 1 minor enhancement
|
||||
* Add support for closing disputes.
|
||||
|
||||
=== 1.8.6 2013-08-13
|
||||
|
||||
* Add Balance and BalanceTransaction API resources
|
||||
* 1 major enhancement
|
||||
* Add Balance and BalanceTransaction resources
|
||||
|
||||
=== 1.8.5 2013-08-12
|
||||
|
||||
* Add support for unsetting attributes by setting to nil.
|
||||
Permits unsetting email and description on customers and description on charges.
|
||||
Setting properties to a blank string is now an error.
|
||||
* Attempting to set an object's id is now an error.
|
||||
* 1 major enhancement
|
||||
* Add support for unsetting attributes by setting to nil. This permits
|
||||
unsetting email and description on customers and description on charges.
|
||||
Setting properties to a blank string is now an error.
|
||||
* Attempting to set an object's id is now an error.
|
||||
|
||||
=== 1.8.4 2013-07-11
|
||||
|
||||
* Add support for new cards API (Stripe API version 2013-07-05)
|
||||
* 1 major enhancement
|
||||
* Add support for new cards API (Stripe API version 2013-07-05)
|
||||
|
||||
=== 1.8.3 2013-05-06
|
||||
|
||||
@ -50,7 +69,7 @@
|
||||
|
||||
=== 1.8.2 2013-05-01
|
||||
|
||||
* 3 minor enhancement:
|
||||
* 3 minor enhancements:
|
||||
* Use to_sym instead of type checking for minor performance
|
||||
improvement (github issue #59)
|
||||
* Handle low-memory situations without throwing an exception (github
|
||||
@ -70,54 +89,74 @@
|
||||
=== 1.8.0 2013-04-11
|
||||
|
||||
* 1 major enhancement:
|
||||
* Add new Recipient API resource
|
||||
* Add new Recipient resource
|
||||
* Allow Transfers to be createable
|
||||
|
||||
=== 1.7.11 2013-02-21
|
||||
* Add 'id' to the list of permanent attributes
|
||||
|
||||
* 1 minor enhancement
|
||||
* Add 'id' to the list of permanent attributes
|
||||
|
||||
=== 1.7.10 2013-02-01
|
||||
* Add support for passing options when retrieving Stripe objects
|
||||
e.g., Stripe::Charge.retrieve({id:"foo", expand:["customer"]})
|
||||
Stripe::Charge("foo") is still supported as well
|
||||
|
||||
* 1 major enhancement
|
||||
* Add support for passing options when retrieving Stripe objects
|
||||
e.g., Stripe::Charge.retrieve({id:"foo", expand:["customer"]})
|
||||
Stripe::Charge("foo") is still supported as well
|
||||
|
||||
=== 1.7.9 2013-01-15
|
||||
* Add support for setting a Stripe API version override.
|
||||
|
||||
* 1 major enhancement
|
||||
* 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)
|
||||
|
||||
* 1 bugfix
|
||||
* Relax the version constraint on multi_json (github issue #44)
|
||||
|
||||
=== 1.7.7 2012-11-07
|
||||
* Add support for updating charge disputes.
|
||||
* Fix Account API resource bug.
|
||||
|
||||
* 1 minor enhancement:
|
||||
* Add support for updating charge disputes
|
||||
|
||||
* 1 bugfix
|
||||
* Fix Account API resource bug
|
||||
|
||||
=== 1.7.6 2012-10-30
|
||||
* Add support for creating invoices.
|
||||
|
||||
* 1 major enhancement
|
||||
* Add support for creating invoices
|
||||
|
||||
=== 1.7.5 2012-10-25
|
||||
* Add support for new API lists.
|
||||
|
||||
* 1 major enhancement
|
||||
* Add support for new API lists
|
||||
|
||||
=== 1.7.4 2012-10-08
|
||||
|
||||
* Fix bug introduced in 1.7.3 calling API methods that take no
|
||||
arguments, like Stripe::Invoice#pay (github issue #42)
|
||||
* 1 bugfix
|
||||
* Fix bug introduced in 1.7.3 calling API methods that take no
|
||||
arguments, like Stripe::Invoice#pay (github issue #42)
|
||||
|
||||
=== 1.7.3 2012-09-14
|
||||
|
||||
* Make sure that both keys and values of GET params are
|
||||
URL-encoded. NOTE: If you were previously URL-encoding values
|
||||
yourself, you may need to adjust your code.
|
||||
* URL-encode POST params directly, instead of allowing rest-client to
|
||||
do it to work around an unfortunate interaction with the hashery gem
|
||||
(github issue #38)
|
||||
* 2 bugfixes
|
||||
* Make sure that both keys and values of GET params are
|
||||
URL-encoded. NOTE: If you were previously URL-encoding values
|
||||
yourself, you may need to adjust your code.
|
||||
* URL-encode POST params directly, instead of allowing rest-client to
|
||||
do it to work around an unfortunate interaction with the hashery gem
|
||||
(github issue #38)
|
||||
|
||||
=== 1.7.2 2012-08-31
|
||||
|
||||
* Add support for new pay and update methods for Invoice objects
|
||||
* 1 major enhancement
|
||||
* Add support for new pay and update methods for Invoice objects
|
||||
|
||||
=== 1.7.1 2012-08-15
|
||||
|
||||
* Add new Account API resource
|
||||
* 1 major enhancement
|
||||
* Add new Account API resource
|
||||
|
||||
=== 1.7.0 2012-05-17
|
||||
|
||||
@ -152,11 +191,13 @@
|
||||
* Fix StripeObject#inspect when ActiveSupport 3.0 is loaded
|
||||
|
||||
=== 1.6.0 2012-02-01
|
||||
* A whole bunch of releases between 1.5.0 and 1.6.0, but few changes, mainly the addition of:
|
||||
- plans
|
||||
- coupons
|
||||
- events
|
||||
- tokens
|
||||
|
||||
* A whole bunch of releases between 1.5.0 and 1.6.0, but few changes, mainly
|
||||
the addition of:
|
||||
- plans
|
||||
- coupons
|
||||
- events
|
||||
- tokens
|
||||
* 1.6.0 also contains a new inspect/to_string implementation
|
||||
|
||||
=== 1.5.0 2011-05-09
|
||||
|
@ -25,7 +25,7 @@ the https://code.stripe.com mirror so all code is fetched over SSL.
|
||||
|
||||
Note that if you are installing via bundler, you should be sure to use the https
|
||||
rubygems source in your Gemfile, as any gems fetched over http could potentially be
|
||||
comprimised in transit and alter the code of gems fetched securely over https:
|
||||
compromised in transit and alter the code of gems fetched securely over https:
|
||||
|
||||
source 'https://code.stripe.com'
|
||||
source 'https://rubygems.org'
|
||||
|
@ -41,6 +41,12 @@ module Stripe
|
||||
subscription
|
||||
end
|
||||
|
||||
def create_subscription(params)
|
||||
response, api_key = Stripe.request(:post, subscriptions_url, @api_key, params)
|
||||
refresh_from({ :subscription => response }, api_key, true)
|
||||
subscription
|
||||
end
|
||||
|
||||
def delete_discount
|
||||
Stripe.request(:delete, discount_url, @api_key)
|
||||
refresh_from({ :discount => nil }, api_key, true)
|
||||
@ -55,5 +61,9 @@ module Stripe
|
||||
def subscription_url
|
||||
url + '/subscription'
|
||||
end
|
||||
|
||||
def subscriptions_url
|
||||
url + '/subscriptions'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,3 @@
|
||||
module Stripe
|
||||
VERSION = '1.10.1'
|
||||
VERSION = '1.10.2'
|
||||
end
|
||||
|
@ -20,10 +20,10 @@ module Stripe
|
||||
@mock.expects(:get).once.returns(test_response(test_customer({:mnemonic => "foo"})))
|
||||
@mock.expects(:post).once.returns(test_response(test_customer({:mnemonic => "bar"})))
|
||||
c = Stripe::Customer.new("test_customer").refresh
|
||||
assert_equal c.mnemonic, "foo"
|
||||
assert_equal "foo", c.mnemonic
|
||||
c.mnemonic = "bar"
|
||||
c.save
|
||||
assert_equal c.mnemonic, "bar"
|
||||
assert_equal "bar", c.mnemonic
|
||||
end
|
||||
|
||||
should "create should return a new customer" do
|
||||
@ -64,6 +64,18 @@ module Stripe
|
||||
c.cancel_subscription
|
||||
end
|
||||
|
||||
should "be able to create a subscription for a customer" do
|
||||
c = Stripe::Customer.new("test_customer")
|
||||
|
||||
@mock.expects(:post).once.with do |url, api_key, params|
|
||||
url == "#{Stripe.api_base}/v1/customers/test_customer/subscriptions" && api_key.nil? && CGI.parse(params) == {'plan' => ['silver']}
|
||||
end.returns(test_response(test_subscription(:plan => 'silver')))
|
||||
s = c.create_subscription({:plan => 'silver'})
|
||||
|
||||
assert_equal 'subscription', s.object
|
||||
assert_equal 'silver', s.plan.identifier
|
||||
end
|
||||
|
||||
should "be able to delete a customer's discount" do
|
||||
@mock.expects(:get).once.returns(test_response(test_customer))
|
||||
c = Stripe::Customer.retrieve("test_customer")
|
||||
|
@ -20,7 +20,7 @@ module Stripe
|
||||
|
||||
@mock.expects(:post).once.with('https://api.stripe.com/v1/invoices/in_test_invoice/pay', nil, '').returns(test_response(test_paid_invoice))
|
||||
i.pay
|
||||
assert_equal i.next_payment_attempt, nil
|
||||
assert_equal nil, i.next_payment_attempt
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -12,9 +12,9 @@ module Stripe
|
||||
should "marshal a stripe object correctly" do
|
||||
obj = Stripe::StripeObject.construct_from({ :id => 1, :name => 'Stripe' }, 'apikey')
|
||||
m = Marshal.load(Marshal.dump(obj))
|
||||
assert_equal m.id, 1
|
||||
assert_equal m.name, 'Stripe'
|
||||
assert_equal m.api_key, 'apikey'
|
||||
assert_equal 1, m.id
|
||||
assert_equal 'Stripe', m.name
|
||||
assert_equal 'apikey', m.api_key
|
||||
end
|
||||
|
||||
should "recursively call to_hash on its values" do
|
||||
|
@ -17,7 +17,7 @@ module Stripe
|
||||
subscription = customer.subscriptions.first
|
||||
subscription.refresh
|
||||
|
||||
assert_equal subscription.id, 'refreshed_subscription'
|
||||
assert_equal 'refreshed_subscription', subscription.id
|
||||
end
|
||||
|
||||
should "subscriptions should be deletable" do
|
||||
@ -38,12 +38,12 @@ module Stripe
|
||||
|
||||
customer = Stripe::Customer.retrieve('test_customer')
|
||||
subscription = customer.subscriptions.first
|
||||
assert_equal subscription.status, 'trialing'
|
||||
assert_equal 'trialing', subscription.status
|
||||
|
||||
subscription.status = 'active'
|
||||
subscription.save
|
||||
|
||||
assert_equal subscription.status, 'active'
|
||||
assert_equal 'active', subscription.status
|
||||
end
|
||||
|
||||
should "create should return a new subscription" do
|
||||
@ -52,7 +52,7 @@ module Stripe
|
||||
|
||||
customer = Stripe::Customer.retrieve('test_customer')
|
||||
subscription = customer.subscriptions.create(:plan => 'silver')
|
||||
assert_equal subscription.id, 'test_new_subscription'
|
||||
assert_equal 'test_new_subscription', subscription.id
|
||||
end
|
||||
|
||||
should "be able to delete a subscriptions's discount" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user