Class: AdvancedBilling::UpgradeChargeCreditType
- Inherits:
-
Object
- Object
- AdvancedBilling::UpgradeChargeCreditType
- Defined in:
- lib/advanced_billing/models/upgrade_charge_credit_type.rb
Overview
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: full - A charge is added for the full price of the component. prorated - A charge is added for the prorated price of the component change. none - No charge is added.
Constant Summary collapse
- UPGRADE_CHARGE_CREDIT_TYPE =
[ # TODO: Write general description for FULL FULL = 'full'.freeze, # TODO: Write general description for PRORATED PRORATED = 'prorated'.freeze, # TODO: Write general description for NONE NONE = 'none'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = FULL) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/advanced_billing/models/upgrade_charge_credit_type.rb', line 30 def self.from_value(value, default_value = FULL) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'full' then FULL when 'prorated' then PRORATED when 'none' then NONE else default_value end end |
.validate(value) ⇒ Object
24 25 26 27 28 |
# File 'lib/advanced_billing/models/upgrade_charge_credit_type.rb', line 24 def self.validate(value) return false if value.nil? UPGRADE_CHARGE_CREDIT_TYPE.include?(value) end |