Class: WalmartApIs::OfferType
- Inherits:
-
Object
- Object
- WalmartApIs::OfferType
- Defined in:
- lib/walmart_ap_is/models/offer_type.rb
Overview
Indicates whether the offer is a B2B or B2C offer.
Constant Summary collapse
- OFFER_TYPE =
[ # TODO: Write general description for B2C B2C = 'B2C'.freeze, # TODO: Write general description for B2B B2B = 'B2B'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = B2C) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/walmart_ap_is/models/offer_type.rb', line 23 def self.from_value(value, default_value = B2C) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'b2c' then B2C when 'b2b' then B2B else default_value end end |
.validate(value) ⇒ Object
17 18 19 20 21 |
# File 'lib/walmart_ap_is/models/offer_type.rb', line 17 def self.validate(value) return false if value.nil? OFFER_TYPE.include?(value) end |