Class: UspsApi::ImageType1

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

Overview

The type of label image requested. * ‘LABEL_BROKER’- Request a USPS QR code to allow your customers with no access to a printer to print at participating Post Office Locations. All USPS API users and third party integrators utilizing QR codes are subject to the [Label Broker terms and conditions](www.usps.com/terms-conditions/label-broker.htm). For more information please see the Label Broker guide available on [GitHub](github.com/USPS/api-examples/blob/main/USPS%20APIs%20Domest ic%20Labels%20API%20Documentation_2023_0901%20Published.pdf). * ‘PDF’ * ‘TIFF’ * ‘ZPL203DPI’ * ‘ZPL300DPI’ * ‘NONE’

Constant Summary collapse

IMAGE_TYPE1 =
[
  # TODO: Write general description for LABEL_BROKER
  LABEL_BROKER = 'LABEL_BROKER'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = LABEL_BROKER) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/usps_api/models/image_type1.rb', line 43

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

  str = value.to_s.strip

  case str.downcase
  when 'label_broker' then LABEL_BROKER
  when 'pdf' then PDF
  when 'tiff' then TIFF
  when 'zpl203dpi' then ZPL203DPI
  when 'zpl300dpi' then ZPL300DPI
  when 'none' then NONE
  else
    default_value
  end
end

.validate(value) ⇒ Object



37
38
39
40
41
# File 'lib/usps_api/models/image_type1.rb', line 37

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

  IMAGE_TYPE1.include?(value)
end