Class: UspsApi::ProcessingCategory11

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

Overview

Processing category for the provided rate, this value can be used in the labels API to ensure the provided rate is applied. * ‘CARDS` - Cards, translates to PTR code `0` * `LETTERS` - Letters, translates to PTR code `1`

  • ‘FLATS` - Flats, translates to PTR code `2` * `MACHINABLE` - Machinable

Parcel, translates to PTR code ‘3` * `IRREGULAR` - Irregular Parcel, translates to PTR code `4` * `NON_MACHINABLE` - Non-machinable parcel, translates to PTR code `5` * `NONSTANDARD` - Nonstandard parcel, translates to PTR code `5` * `CATALOGS` - Catalogs, translates to PTR code `C` * `OPEN_AND_DISTRIBUTE` - Open and Distribute, translates to PTR code `O` * `RETURNS` - Returns, translates to PTR code `R` * `SOFT_PACK_MACHINABLE` - Soft Pack Machinable, translates to PTR code `S` * `SOFT_PACK_NON_MACHINABLE` - Soft Package Non-machinable, translates to PTR code `T` Note: * `IRREGULAR` is deprecated and will convert to `NONSTANDARD` as of 01/19/2025. * `NON_MACHINABLE` is deprecated and will convert to `NONSTANDARD` as of 01/19/2025.

Constant Summary collapse

PROCESSING_CATEGORY11 =
[
  # TODO: Write general description for CARDS
  CARDS = 'CARDS'.freeze,

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

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

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

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

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

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CARDS) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/usps_api/models/processing_category11.rb', line 67

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

  str = value.to_s.strip

  case str.downcase
  when 'cards' then CARDS
  when 'letters' then LETTERS
  when 'flats' then FLATS
  when 'machinable' then MACHINABLE
  when 'irregular' then IRREGULAR
  when 'non_machinable' then NON_MACHINABLE
  when 'nonstandard' then NONSTANDARD
  when 'catalogs' then CATALOGS
  when 'open_and_distribute' then OPEN_AND_DISTRIBUTE
  when 'returns' then RETURNS
  when 'soft_pack_machinable' then SOFT_PACK_MACHINABLE
  when 'soft_pack_non_machinable' then SOFT_PACK_NON_MACHINABLE
  else
    default_value
  end
end

.validate(value) ⇒ Object



61
62
63
64
65
# File 'lib/usps_api/models/processing_category11.rb', line 61

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

  PROCESSING_CATEGORY11.include?(value)
end