Class: WalmartApIs::ChannelType

Inherits:
Object
  • Object
show all
Defined in:
lib/walmart_ap_is/models/channel_type.rb

Overview

Sales-channel hint that lets shipping-v4 route differently for WFS-fulfilled orders, marketplace-seller-fulfilled orders, and external (off-Walmart) orders.

Constant Summary collapse

CHANNEL_TYPE =
[
  # TODO: Write general description for WALMART_MARKETPLACE
  WALMART_MARKETPLACE = 'WALMART_MARKETPLACE'.freeze,

  # TODO: Write general description for EXTERNAL
  EXTERNAL = 'EXTERNAL'.freeze,

  # TODO: Write general description for WFS
  WFS = 'WFS'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = WALMART_MARKETPLACE) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/walmart_ap_is/models/channel_type.rb', line 28

def self.from_value(value, default_value = WALMART_MARKETPLACE)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'walmart_marketplace' then WALMART_MARKETPLACE
  when 'external' then EXTERNAL
  when 'wfs' then WFS
  else
    default_value
  end
end

.validate(value) ⇒ Object



22
23
24
25
26
# File 'lib/walmart_ap_is/models/channel_type.rb', line 22

def self.validate(value)
  return false if value.nil?

  CHANNEL_TYPE.include?(value)
end