Class: UspsApi::BrandingImageFormat

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

Overview

The format of label branding images to be shown on the generated label image. Note: * Label branding images will not be shown on labels with customs forms. * Label branding images are not currently supported with an ‘imageType` of `ZPL203DPI` or `ZPL300DPI`. * Label branding images are not currently supported with a `labelType` of `4X4LABEL`. * When a `brandingImageFormat` is provided with a Destination Entry Facility, the Drop-Off Location will not be displayed on the label. * When a `brandingImageFormat` of `RECTANGLE` is provided, Customer Reference #3-#4 cannot be provided since they will not be shown. * When a `brandingImageFormat` of `ONE_SQUARE` or `TWO_SQUARES` is provided, Customer Reference numbers will be shifted to the right to accommodate the image. * When a `brandingImageFormat` of `RECTANGLE` is provided, Customer Reference numbers, package number, and total packages will not be displayed on the label. * A `brandingImageFormat` of `ONE_SQUARE` is currently only supported with `labelType` of `4X6LABEL`, `4X5LABEL`, `6X4LABEL`, and `2X7LABEL` for both outbound and return labels. * A `brandingImageFormat` of `TWO_SQUARES` is currently only supported with `labelType` of `4X6LABEL`, `4X5LABEL`, and `6X4LABEL` for both outbound and return labels. * A `brandingImageFormat` of `RECTANGLE` is currently only supported with `labelType` of `4X6LABEL`, `4X5LABEL`, and `6X4LABEL` for outbound labels and `4X5LABEL` and `6X4LABEL` for return labels.

Constant Summary collapse

BRANDING_IMAGE_FORMAT =
[
  # TODO: Write general description for ONE_SQUARE
  ONE_SQUARE = 'ONE_SQUARE'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ONE_SQUARE) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/usps_api/models/branding_image_format.rb', line 49

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

  str = value.to_s.strip

  case str.downcase
  when 'one_square' then ONE_SQUARE
  when 'two_squares' then TWO_SQUARES
  when 'rectangle' then RECTANGLE
  when 'none' then NONE
  else
    default_value
  end
end

.validate(value) ⇒ Object



43
44
45
46
47
# File 'lib/usps_api/models/branding_image_format.rb', line 43

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

  BRANDING_IMAGE_FORMAT.include?(value)
end