Class: UspsApi::ProcessingCategory4

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

Overview

USPS® categorizes international parcels into four processing categories. These categories are based on the physical dimensions of the piece and impact how the mail will be processed. * ‘LETTERS` * `FLATS` * `MACHINABLE` * `NONSTANDARD` * `NON_MACHINABLE` is deprecated and will convert to `NONSTANDARD` as of 01/19/2025

Constant Summary collapse

PROCESSING_CATEGORY4 =
[
  # 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 NON_MACHINABLE
  NON_MACHINABLE = 'NON_MACHINABLE'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = LETTERS) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'letters' then LETTERS
  when 'flats' then FLATS
  when 'machinable' then MACHINABLE
  when 'non_machinable' then NON_MACHINABLE
  when 'nonstandard' then NONSTANDARD
  else
    default_value
  end
end

.validate(value) ⇒ Object



30
31
32
33
34
# File 'lib/usps_api/models/processing_category4.rb', line 30

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

  PROCESSING_CATEGORY4.include?(value)
end