Class: WalmartApIs::ConditionType1
- Inherits:
-
Object
- Object
- WalmartApIs::ConditionType1
- Defined in:
- lib/walmart_ap_is/models/condition_type1.rb
Overview
conditionType1.
Constant Summary collapse
- CONDITION_TYPE1 =
[ # TODO: Write general description for NEW_NEW NEW_NEW = 'new_new'.freeze, # TODO: Write general description for USED_LIKE_NEW USED_LIKE_NEW = 'used_like_new'.freeze, # TODO: Write general description for USED_VERY_GOOD USED_VERY_GOOD = 'used_very_good'.freeze, # TODO: Write general description for USED_GOOD USED_GOOD = 'used_good'.freeze, # TODO: Write general description for USED_ACCEPTABLE USED_ACCEPTABLE = 'used_acceptable'.freeze, # TODO: Write general description for COLLECTIBLE_LIKE_NEW COLLECTIBLE_LIKE_NEW = 'collectible_like_new'.freeze, # TODO: Write general description for COLLECTIBLE_VERY_GOOD COLLECTIBLE_VERY_GOOD = 'collectible_very_good'.freeze, # TODO: Write general description for COLLECTIBLE_GOOD COLLECTIBLE_GOOD = 'collectible_good'.freeze, # TODO: Write general description for COLLECTIBLE_ACCEPTABLE COLLECTIBLE_ACCEPTABLE = 'collectible_acceptable'.freeze, # TODO: Write general description for REFURBISHED_REFURBISHED REFURBISHED_REFURBISHED = 'refurbished_refurbished'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = NEW_NEW) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/walmart_ap_is/models/condition_type1.rb', line 47 def self.from_value(value, default_value = NEW_NEW) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'new_new' then NEW_NEW when 'used_like_new' then USED_LIKE_NEW when 'used_very_good' then USED_VERY_GOOD when 'used_good' then USED_GOOD when 'used_acceptable' then USED_ACCEPTABLE when 'collectible_like_new' then COLLECTIBLE_LIKE_NEW when 'collectible_very_good' then COLLECTIBLE_VERY_GOOD when 'collectible_good' then COLLECTIBLE_GOOD when 'collectible_acceptable' then COLLECTIBLE_ACCEPTABLE when 'refurbished_refurbished' then REFURBISHED_REFURBISHED else default_value end end |
.validate(value) ⇒ Object
41 42 43 44 45 |
# File 'lib/walmart_ap_is/models/condition_type1.rb', line 41 def self.validate(value) return false if value.nil? CONDITION_TYPE1.include?(value) end |