Class: WalmartApIs::BoxContentInformationSource

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

Overview

Indication of how box content is meant to be provided.

Constant Summary collapse

BOX_CONTENT_INFORMATION_SOURCE =
[
  # TODO: Write general description for BOX_CONTENT_PROVIDED
  BOX_CONTENT_PROVIDED = 'BOX_CONTENT_PROVIDED'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BOX_CONTENT_PROVIDED) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'box_content_provided' then BOX_CONTENT_PROVIDED
  when 'manual_process' then MANUAL_PROCESS
  when 'barcode_2d' then BARCODE_2D
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/walmart_ap_is/models/box_content_information_source.rb', line 20

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

  BOX_CONTENT_INFORMATION_SOURCE.include?(value)
end