Class: NewStoreApi::TaxCalculationStrategyEnum
- Inherits:
-
Object
- Object
- NewStoreApi::TaxCalculationStrategyEnum
- Defined in:
- lib/new_store_api/models/tax_calculation_strategy_enum.rb
Overview
Tax calculation strategy.
Constant Summary collapse
- TAX_CALCULATION_STRATEGY_ENUM =
[ # TODO: Write general description for FIXEDRATE FIXEDRATE = 'fixedrate'.freeze, # TODO: Write general description for FIXED_RATE_PER_COUNTRY FIXED_RATE_PER_COUNTRY = 'fixed_rate_per_country'.freeze, # TODO: Write general description for AVALARA AVALARA = 'avalara'.freeze, # TODO: Write general description for VERTEX VERTEX = 'vertex'.freeze, # TODO: Write general description for CUSTOM CUSTOM = 'custom'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = FIXEDRATE) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/new_store_api/models/tax_calculation_strategy_enum.rb', line 32 def self.from_value(value, default_value = FIXEDRATE) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'fixedrate' then FIXEDRATE when 'fixed_rate_per_country' then FIXED_RATE_PER_COUNTRY when 'avalara' then AVALARA when 'vertex' then VERTEX when 'custom' then CUSTOM else default_value end end |
.validate(value) ⇒ Object
26 27 28 29 30 |
# File 'lib/new_store_api/models/tax_calculation_strategy_enum.rb', line 26 def self.validate(value) return false if value.nil? TAX_CALCULATION_STRATEGY_ENUM.include?(value) end |