Class: WalmartApIs::FulfillmentChannelType

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

Overview

Indicates whether the item is fulfilled by the seller or by Walmart Fulfillment Services.

Constant Summary collapse

FULFILLMENT_CHANNEL_TYPE =
[
  # TODO: Write general description for WFS
  WFS = 'WFS'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = WFS) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/walmart_ap_is/models/fulfillment_channel_type.rb', line 24

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

  str = value.to_s.strip

  case str.downcase
  when 'wfs' then WFS
  when 'seller' then SELLER
  else
    default_value
  end
end

.validate(value) ⇒ Object



18
19
20
21
22
# File 'lib/walmart_ap_is/models/fulfillment_channel_type.rb', line 18

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

  FULFILLMENT_CHANNEL_TYPE.include?(value)
end