diff --git a/samples/coupons.rb b/samples/coupons.rb index d4ce506..37eb02e 100644 --- a/samples/coupons.rb +++ b/samples/coupons.rb @@ -24,6 +24,9 @@ # Lookup up existing coupon using the product_family_id and the coupon code coupon = Chargify::Subscription::Coupon.find_by_product_family_id_and_code(2,"10OFF") +# Looking up all coupons for a product family +coupons = Chargify::Coupon.find_all_by_product_family_id(12345) + # Update coupon information coupon = Chargify::Coupon.find_by_product_family_id_and_code(2,"10OFF") coupon.code = "FOO" @@ -38,10 +41,10 @@ coupon.usage #>> [{"name"=>"Product 1", "savings"=>0.0, "id"=>8, "signups"=>5, "revenue"=>0.0}, {"name"=>"Product 2", "savings"=>0.0, "id"=>9, "signups"=>0, "revenue"=>0.0}] -#Apply coupon to subscription +# Apply coupon to subscription subscription = Subscription.find_by_customer_reference('moklett') subscription.add_coupon('5OFF') -#Remove coupon from subscription +# Remove coupon from subscription subscription = Subscription.find_by_customer_reference('moklett') -subscription.remove_coupon('50OFF') \ No newline at end of file +subscription.remove_coupon('50OFF')