Skip to content

Commit 78fc0a6

Browse files
committed
Make coupon subcodes findable
The previous code was able to find coupons by code, but there was no way to find them by their subcodes.
1 parent cc54438 commit 78fc0a6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/chargify_api_ares/resources/coupon.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def self.find_all_by_product_family_id(product_family_id)
77
end
88

99
def self.find_by_product_family_id_and_code(product_family_id, code)
10-
find(:one, :from => :lookup, :params => {:product_family_id => product_family_id, :code => code})
10+
find(:one, :from => :find, :params => {:product_family_id => product_family_id, :code => code})
1111
end
1212

1313
def self.validate(params = {})

spec/resources/coupon_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
let(:existing_coupon) { build(:coupon, :code => '20OFF') }
66

77
before(:each) do
8-
FakeWeb.register_uri(:get, "#{test_domain}/coupons/lookup.xml?code=#{existing_coupon.code}&product_family_id=10", :body => existing_coupon.attributes.to_xml)
8+
FakeWeb.register_uri(:get, "#{test_domain}/coupons/find.xml?code=#{existing_coupon.code}&product_family_id=10", :body => existing_coupon.attributes.to_xml)
99
end
1010

1111
it "finds the correct coupon by product family and code" do

0 commit comments

Comments
 (0)