Class: WalmartApIs::RegulatedCategory
- Inherits:
-
Object
- Object
- WalmartApIs::RegulatedCategory
- Defined in:
- lib/walmart_ap_is/models/regulated_category.rb
Overview
Top-level category of regulation that applies. NOT_REGULATED means no verification is required and the rest of the fields are informational only.
Constant Summary collapse
- REGULATED_CATEGORY =
[ # TODO: Write general description for NOT_REGULATED NOT_REGULATED = 'NOT_REGULATED'.freeze, # TODO: Write general description for ALCOHOL ALCOHOL = 'ALCOHOL'.freeze, # TODO: Write general description for TOBACCO TOBACCO = 'TOBACCO'.freeze, # TODO: Write general description for AGE_RESTRICTED AGE_RESTRICTED = 'AGE_RESTRICTED'.freeze, # TODO: Write general description for PHARMACY PHARMACY = 'PHARMACY'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = NOT_REGULATED) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/walmart_ap_is/models/regulated_category.rb', line 33 def self.from_value(value, default_value = NOT_REGULATED) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'not_regulated' then NOT_REGULATED when 'alcohol' then ALCOHOL when 'tobacco' then TOBACCO when 'age_restricted' then AGE_RESTRICTED when 'pharmacy' then PHARMACY else default_value end end |
.validate(value) ⇒ Object
27 28 29 30 31 |
# File 'lib/walmart_ap_is/models/regulated_category.rb', line 27 def self.validate(value) return false if value.nil? REGULATED_CATEGORY.include?(value) end |