Class: AdvancedBilling::PricingScheme
- Inherits:
-
Object
- Object
- AdvancedBilling::PricingScheme
- Defined in:
- lib/advanced_billing/models/pricing_scheme.rb
Overview
The identifier for the pricing scheme. See [Product Components](help.chargify.com/products/product-components.html) for an overview of pricing schemes.
Constant Summary collapse
- PRICING_SCHEME =
[ # TODO: Write general description for STAIRSTEP STAIRSTEP = 'stairstep'.freeze, # TODO: Write general description for VOLUME VOLUME = 'volume'.freeze, # TODO: Write general description for PER_UNIT PER_UNIT = 'per_unit'.freeze, # TODO: Write general description for TIERED TIERED = 'tiered'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = STAIRSTEP) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/advanced_billing/models/pricing_scheme.rb', line 31 def self.from_value(value, default_value = STAIRSTEP) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'stairstep' then STAIRSTEP when 'volume' then VOLUME when 'per_unit' then PER_UNIT when 'tiered' then TIERED else default_value end end |
.validate(value) ⇒ Object
25 26 27 28 29 |
# File 'lib/advanced_billing/models/pricing_scheme.rb', line 25 def self.validate(value) return false if value.nil? PRICING_SCHEME.include?(value) end |