Class: NewStoreApi::ReasonTypeEnum
- Inherits:
-
Object
- Object
- NewStoreApi::ReasonTypeEnum
- Defined in:
- lib/new_store_api/models/reason_type_enum.rb
Overview
Whether the override cites a predefined reason code or a free-text custom reason.
Constant Summary collapse
- REASON_TYPE_ENUM =
[ # TODO: Write general description for REASON_CODE REASON_CODE = 'reason_code'.freeze, # TODO: Write general description for CUSTOM_REASON CUSTOM_REASON = 'custom_reason'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = REASON_CODE) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/new_store_api/models/reason_type_enum.rb', line 24 def self.from_value(value, default_value = REASON_CODE) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'reason_code' then REASON_CODE when 'custom_reason' then CUSTOM_REASON else default_value end end |
.validate(value) ⇒ Object
18 19 20 21 22 |
# File 'lib/new_store_api/models/reason_type_enum.rb', line 18 def self.validate(value) return false if value.nil? REASON_TYPE_ENUM.include?(value) end |