Class: NewStoreApi::ExemptionClassEnum
- Inherits:
-
Object
- Object
- NewStoreApi::ExemptionClassEnum
- Defined in:
- lib/new_store_api/models/exemption_class_enum.rb
Overview
The tax exemption class that identifies the customer's group/organization
that accredited them with the tax exemption status. * For custom tax
exemption classes, the CUSTOM_ prefix with a UPPER_SNAKE_CASE key can be
used. Example: CUSTOM_CANADA
Constant Summary collapse
- EXEMPTION_CLASS_ENUM =
[ # TODO: Write general description for FEDERAL_GOVERNMENT FEDERAL_GOVERNMENT = 'FEDERAL_GOVERNMENT'.freeze, # TODO: Write general description for STATE_GOVERNMENT STATE_GOVERNMENT = 'STATE_GOVERNMENT'.freeze, # TODO: Write general description for TRIBAL_GOVERNMENT TRIBAL_GOVERNMENT = 'TRIBAL_GOVERNMENT'.freeze, # TODO: Write general description for LOCAL_GOVERNMENT LOCAL_GOVERNMENT = 'LOCAL_GOVERNMENT'.freeze, # TODO: Write general description for FOREIGN_DIPLOMAT FOREIGN_DIPLOMAT = 'FOREIGN_DIPLOMAT'.freeze, # TODO: Write general description for CHARITY_ORGANIZATION CHARITY_ORGANIZATION = 'CHARITY_ORGANIZATION'.freeze, # TODO: Write general description for RELIGIOUS_ORGANIZATION RELIGIOUS_ORGANIZATION = 'RELIGIOUS_ORGANIZATION'.freeze, # TODO: Write general description for EDUCATIONAL_ORGANIZATION EDUCATIONAL_ORGANIZATION = 'EDUCATIONAL_ORGANIZATION'.freeze, # TODO: Write general description for RESALE RESALE = 'RESALE'.freeze, # TODO: Write general description for DIRECT_PAY_PERMIT DIRECT_PAY_PERMIT = 'DIRECT_PAY_PERMIT'.freeze, # TODO: Write general description for OTHER OTHER = 'OTHER'.freeze, # TODO: Write general description for NON_RESIDENT NON_RESIDENT = 'NON_RESIDENT'.freeze, # TODO: Write general description for FIRST_NATION_CITIZEN FIRST_NATION_CITIZEN = 'FIRST_NATION_CITIZEN'.freeze, # TODO: Write general description for ENUM_CUSTOM_ ENUM_CUSTOM_ = 'CUSTOM_*'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = FEDERAL_GOVERNMENT) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/new_store_api/models/exemption_class_enum.rb', line 62 def self.from_value(value, default_value = FEDERAL_GOVERNMENT) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'federal_government' then FEDERAL_GOVERNMENT when 'state_government' then STATE_GOVERNMENT when 'tribal_government' then TRIBAL_GOVERNMENT when 'local_government' then LOCAL_GOVERNMENT when 'foreign_diplomat' then FOREIGN_DIPLOMAT when 'charity_organization' then CHARITY_ORGANIZATION when 'religious_organization' then RELIGIOUS_ORGANIZATION when 'educational_organization' then EDUCATIONAL_ORGANIZATION when 'resale' then RESALE when 'direct_pay_permit' then DIRECT_PAY_PERMIT when 'other' then OTHER when 'non_resident' then NON_RESIDENT when 'first_nation_citizen' then FIRST_NATION_CITIZEN when 'enum_custom_' then ENUM_CUSTOM_ else default_value end end |
.validate(value) ⇒ Object
56 57 58 59 60 |
# File 'lib/new_store_api/models/exemption_class_enum.rb', line 56 def self.validate(value) return false if value.nil? EXEMPTION_CLASS_ENUM.include?(value) end |