Class: WalmartApIs::CancellationReason
- Inherits:
-
Object
- Object
- WalmartApIs::CancellationReason
- Defined in:
- lib/walmart_ap_is/models/cancellation_reason.rb
Overview
CancellationReason.
Constant Summary collapse
- CANCELLATION_REASON =
[ # TODO: Write general description for CUSTOMER_REQUESTED CUSTOMER_REQUESTED = 'CUSTOMER_REQUESTED'.freeze, # TODO: Write general description for OUT_OF_STOCK OUT_OF_STOCK = 'OUT_OF_STOCK'.freeze, # TODO: Write general description for PRICE_ERROR PRICE_ERROR = 'PRICE_ERROR'.freeze, # TODO: Write general description for SELLER_INITIATED SELLER_INITIATED = 'SELLER_INITIATED'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = CUSTOMER_REQUESTED) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/walmart_ap_is/models/cancellation_reason.rb', line 29 def self.from_value(value, default_value = CUSTOMER_REQUESTED) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'customer_requested' then CUSTOMER_REQUESTED when 'out_of_stock' then OUT_OF_STOCK when 'price_error' then PRICE_ERROR when 'seller_initiated' then SELLER_INITIATED else default_value end end |
.validate(value) ⇒ Object
23 24 25 26 27 |
# File 'lib/walmart_ap_is/models/cancellation_reason.rb', line 23 def self.validate(value) return false if value.nil? CANCELLATION_REASON.include?(value) end |