Class: WalmartApIs::LabelPrintType

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

Overview

Indicates the type of print type for a given label.

Constant Summary collapse

LABEL_PRINT_TYPE =
[
  # TODO: Write general description for STANDARD_FORMAT
  STANDARD_FORMAT = 'STANDARD_FORMAT'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = STANDARD_FORMAT) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'standard_format' then STANDARD_FORMAT
  when 'thermal_printing' then THERMAL_PRINTING
  else
    default_value
  end
end

.validate(value) ⇒ Object



17
18
19
20
21
# File 'lib/walmart_ap_is/models/label_print_type.rb', line 17

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

  LABEL_PRINT_TYPE.include?(value)
end