Class: AdvancedBilling::CurrencyPriceRole
- Inherits:
-
Object
- Object
- AdvancedBilling::CurrencyPriceRole
- Defined in:
- lib/advanced_billing/models/currency_price_role.rb
Overview
Role for the price.
Constant Summary collapse
- CURRENCY_PRICE_ROLE =
[ # TODO: Write general description for BASELINE BASELINE = 'baseline'.freeze, # TODO: Write general description for TRIAL TRIAL = 'trial'.freeze, # TODO: Write general description for INITIAL INITIAL = 'initial'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = BASELINE) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/advanced_billing/models/currency_price_role.rb', line 26 def self.from_value(value, default_value = BASELINE) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'baseline' then BASELINE when 'trial' then TRIAL when 'initial' then INITIAL else default_value end end |
.validate(value) ⇒ Object
20 21 22 23 24 |
# File 'lib/advanced_billing/models/currency_price_role.rb', line 20 def self.validate(value) return false if value.nil? CURRENCY_PRICE_ROLE.include?(value) end |