Class: WalmartApIs::LabelOwner

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

Overview

Specifies who will label the items. Options include SELLER and NONE., The owner of the preparations, if special preparations are required., Specifies who will label the items. Options include SELLER and NONE., The owner of the preparations, if special preparations are required., Specifies who will label the items. Options include SELLER and NONE., The owner of the preparations, if special preparations are required.

Constant Summary collapse

LABEL_OWNER =
[
  # TODO: Write general description for SELLER
  SELLER = 'SELLER'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = SELLER) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'seller' then SELLER
  when 'none' then NONE
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  LABEL_OWNER.include?(value)
end