Class: UspsApi::LabelType21

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

Overview

Ability to select the indicia image size. If omitted then the default indicia size is 2X1.5LABEL. - Using ‘2X1.5LABEL` will return the image in the `indiciaImage` response field. - Using `IMI_DATA_ONLY` will return the IMI data in the `indiciaIMI` response field and not populate the `indiciaImage` field.

Constant Summary collapse

LABEL_TYPE21 =
[
  # TODO: Write general description for ENUM_2X15LABEL
  ENUM_2X15LABEL = '2X1.5LABEL'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_2X15LABEL) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'enum_2x15label' then ENUM_2X15LABEL
  when 'imi_data_only' then IMI_DATA_ONLY
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/usps_api/models/label_type21.rb', line 21

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

  LABEL_TYPE21.include?(value)
end