Add coupon update

This commit is contained in:
Kyle Conroy 2014-08-06 15:37:25 -07:00
parent 4aed61af42
commit 8d066ca608
3 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,7 @@
module Stripe module Stripe
class Coupon < APIResource class Coupon < APIResource
include Stripe::APIOperations::Create include Stripe::APIOperations::Create
include Stripe::APIOperations::Update
include Stripe::APIOperations::Delete include Stripe::APIOperations::Delete
include Stripe::APIOperations::List include Stripe::APIOperations::List
end end

View File

@ -7,5 +7,14 @@ module Stripe
c = Stripe::Coupon.create c = Stripe::Coupon.create
assert_equal "co_test_coupon", c.id assert_equal "co_test_coupon", c.id
end end
should "coupons should be updateable" do
@mock.expects(:get).once.returns(test_response(test_coupon))
@mock.expects(:post).once.returns(test_response(test_coupon))
c = Stripe::Coupon.new("test_coupon")
c.refresh
c.metadata['foo'] = 'bar'
c.save
end
end end
end end

View File

@ -201,7 +201,8 @@ def test_coupon(params={})
:duration_in_months => 3, :duration_in_months => 3,
:percent_off => 25, :percent_off => 25,
:id => "co_test_coupon", :id => "co_test_coupon",
:object => "coupon" :object => "coupon",
:metadata => {},
}.merge(params) }.merge(params)
end end