Sha256: 7956d753a2e22bcbc551ecc5917bbdd270b106a993354921cded4cb5a267b80a

Contents?: true

Size: 989 Bytes

Versions: 3

Compression:

Stored size: 989 Bytes

Contents

module Chargify
  class ProductFamily < Base
    def self.find_by_handle(handle, attributes = {})
      ProductFamily.find(:one, :from => :lookup, :params => { :handle => handle })
    end
    
    class Product < Base
      self.prefix = "/product_families/:product_family_id/"
    end
    
    class Component < Base
      self.prefix = "/product_families/:product_family_id/"
    end
    
    class Coupon < Base
      self.prefix = "/product_families/:product_family_id/"
    end
    
    def products(params = {})
      params.merge!(:product_family_id => self.id)
      ::Chargify::ProductFamily::Product.find(:all, :params => params)
    end
    
    def components(params = {})
      params.merge!({:product_family_id => self.id})
      ::Chargify::ProductFamily::Component.find(:all, :params => params)
    end

    def coupons(params = {})
      params.merge!(:product_family_id => self.id)
      ::Chargify::ProductFamily::Coupon.find(:all, :params => params)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chargify_api_ares-0.5.2 lib/chargify_api_ares/resources/product_family.rb
chargify_api_ares-0.5.1 lib/chargify_api_ares/resources/product_family.rb
chargify_api_ares-0.5.0 lib/chargify_api_ares/resources/product_family.rb