Permalink
Browse files

Coupon code not required for Subscription#remove_coupon. closes #26

  • Loading branch information...
1 parent a43c5c4 commit ab43edf80c6de6352842224593a04247566959da @russolsen russolsen committed with shayfrendt Nov 8, 2011
Showing with 9 additions and 5 deletions.
  1. +1 −1 examples/coupons.rb
  2. +8 −4 lib/chargify_api_ares/resources/subscription.rb
View
@@ -47,4 +47,4 @@
# Remove coupon from subscription
subscription = Subscription.find_by_customer_reference('moklett')
-subscription.remove_coupon('50OFF')
+subscription.remove_coupon
@@ -81,13 +81,17 @@ def add_coupon(code)
post :add_coupon, :code => code
end
- def remove_coupon(code)
- delete :remove_coupon, :code => code
+ def remove_coupon(code=nil)
+ if code.nil?
+ delete :remove_coupon
+ else
+ delete :remove_coupon, :code => code
+ end
end
class Component < Base
self.prefix = "/subscriptions/:subscription_id/"
-
+
# All Subscription Components are considered already existing records, but the id isn't used
def id
self.component_id
@@ -100,7 +104,7 @@ class Statement < Base
class Transaction < Base
self.prefix = "/subscriptions/:subscription_id/"
-
+
def full_refund(attrs = {})
return false if self.transaction_type != 'payment'

0 comments on commit ab43edf

Please sign in to comment.