Class: UspsApi::LabelType3

Inherits:
Object
  • Object
show all
Defined in:
lib/usps_api/models/label_type3.rb

Overview

Ability to select the label image size. If omitted then the default label size is ‘4X6LABEL`. Note: * Currently, customs forms only support `4X6LABEL`. * The `labelType` of `2X7LABEL` is not supported with the `imageType` of `ZPL203DPI` or `ZPL300DPI`.

Constant Summary collapse

LABEL_TYPE3 =
[
  # TODO: Write general description for ENUM_4X4LABEL
  ENUM_4X4LABEL = '4X4LABEL'.freeze,

  # TODO: Write general description for ENUM_4X5LABEL
  ENUM_4X5LABEL = '4X5LABEL'.freeze,

  # TODO: Write general description for ENUM_4X6LABEL
  ENUM_4X6LABEL = '4X6LABEL'.freeze,

  # TODO: Write general description for ENUM_6X4LABEL
  ENUM_6X4LABEL = '6X4LABEL'.freeze,

  # TODO: Write general description for ENUM_2X7LABEL
  ENUM_2X7LABEL = '2X7LABEL'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_4X4LABEL) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/usps_api/models/label_type3.rb', line 35

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

  str = value.to_s.strip

  case str.downcase
  when 'enum_4x4label' then ENUM_4X4LABEL
  when 'enum_4x5label' then ENUM_4X5LABEL
  when 'enum_4x6label' then ENUM_4X6LABEL
  when 'enum_6x4label' then ENUM_6X4LABEL
  when 'enum_2x7label' then ENUM_2X7LABEL
  else
    default_value
  end
end

.validate(value) ⇒ Object



29
30
31
32
33
# File 'lib/usps_api/models/label_type3.rb', line 29

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

  LABEL_TYPE3.include?(value)
end