Class: AdvancedBilling::PricePointType
- Inherits:
-
Object
- Object
- AdvancedBilling::PricePointType
- Defined in:
- lib/advanced_billing/models/price_point_type.rb
Overview
Price point type. We expose the following types: 1. default: a price point that is marked as a default price for a certain product. 2. custom: a custom price point. 3. catalog: a price point that is not marked as a default price for a certain product and is not a custom one.
Constant Summary collapse
- PRICE_POINT_TYPE =
[ # TODO: Write general description for CATALOG CATALOG = 'catalog'.freeze, # TODO: Write general description for DEFAULT DEFAULT = 'default'.freeze, # TODO: Write general description for CUSTOM CUSTOM = 'custom'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = CATALOG) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/advanced_billing/models/price_point_type.rb', line 30 def self.from_value(value, default_value = CATALOG) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'catalog' then CATALOG when 'default' then DEFAULT when 'custom' then CUSTOM else default_value end end |
.validate(value) ⇒ Object
24 25 26 27 28 |
# File 'lib/advanced_billing/models/price_point_type.rb', line 24 def self.validate(value) return false if value.nil? PRICE_POINT_TYPE.include?(value) end |