Sha256: cfd79b2f16940e509911eca1ec187ebfcb90e968ecef32ef08a744a4b803aa28
Contents?: true
Size: 980 Bytes
Versions: 5
Compression:
Stored size: 980 Bytes
Contents
module Chargify class Coupon < Base include ResponseHelper def self.find_all_by_product_family_id(product_family_id) Coupon.find(:all, :params => { :product_family_id => product_family_id }) end def self.find_by_product_family_id_and_code(product_family_id, code) find(:one, :from => :find, :params => {:product_family_id => product_family_id, :code => code}) end def self.validate(params = {}) product_family_id = params.fetch(:product_family_id, nil) coupon_code = params.fetch(:coupon_code, nil) raise ArgumentError, 'coupon_code is a required argument' if coupon_code.blank? params = {:coupon_code => coupon_code} params.merge!(:product_family_id => product_family_id) if product_family_id.present? find :one, :from => :validate, :params => params end def usage process_capturing_errors do get :usage end end def archive self.destroy end end end
Version data entries
5 entries across 5 versions & 1 rubygems