Class: NewStoreApi::SectionEnum
- Inherits:
-
Object
- Object
- NewStoreApi::SectionEnum
- Defined in:
- lib/new_store_api/models/section_enum.rb
Overview
section.
Constant Summary collapse
- SECTION_ENUM =
[ # TODO: Write general description for ROUTES ROUTES = 'routes'.freeze, # TODO: Write general description for SL_LEVELS_PRIORITY SL_LEVELS_PRIORITY = 'sl_levels_priority'.freeze, # TODO: Write general description for LOCATION_GROUPS LOCATION_GROUPS = 'location_groups'.freeze, # TODO: Write general description for ZIP_CODE_REGIONS ZIP_CODE_REGIONS = 'zip_code_regions'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ROUTES) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/new_store_api/models/section_enum.rb', line 29 def self.from_value(value, default_value = ROUTES) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'routes' then ROUTES when 'sl_levels_priority' then SL_LEVELS_PRIORITY when 'location_groups' then LOCATION_GROUPS when 'zip_code_regions' then ZIP_CODE_REGIONS else default_value end end |
.validate(value) ⇒ Object
23 24 25 26 27 |
# File 'lib/new_store_api/models/section_enum.rb', line 23 def self.validate(value) return false if value.nil? SECTION_ENUM.include?(value) end |