mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-12-07 00:00:35 -05:00
Add coupon update
This commit is contained in:
parent
4aed61af42
commit
8d066ca608
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user