Support deleting SKUs and products.

This commit is contained in:
Rasmus Rygaard 2016-01-25 10:32:49 -08:00
parent 03086b8086
commit 8d8fb67aae
4 changed files with 17 additions and 12 deletions

View File

@ -3,6 +3,7 @@ module Stripe
extend Stripe::APIOperations::List
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Update
include Stripe::APIOperations::Delete
# Keep APIResource#url as `api_url` to avoid letting the external URL
# replace the Stripe URL.

View File

@ -3,6 +3,7 @@ module Stripe
extend Stripe::APIOperations::List
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Update
include Stripe::APIOperations::Delete
end
end

View File

@ -11,12 +11,14 @@ module Stripe
end
end
should "products should not be deletable" do
assert_raises NoMethodError do
should "products should be deletable" do
@mock.expects(:get).once.returns(make_response(make_product))
@mock.expects(:delete).once.
returns(make_response(make_product(:deleted => true)))
p = Stripe::Product.retrieve("test_product")
p.delete
end
assert p.deleted
end
should "products should be updateable" do

View File

@ -12,12 +12,13 @@ module Stripe
end
end
should "SKUs should not be deletable" do
assert_raises NoMethodError do
should "SKUs should be deletable" do
@mock.expects(:get).once.returns(make_response(make_sku))
p = Stripe::SKU.retrieve("test_product")
p.delete
end
@mock.expects(:delete).once.returns(make_response(make_sku(:deleted => true)))
s = Stripe::SKU.retrieve("test_sku")
s.delete
assert s.deleted
end
end