Class: UspsApi::ProcessingCategory6

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

Overview

Designates what shape the facility accepts for packages. For more information on package shapes see the [Physical Standards for Parcels](pe.usps.com/text/dmm300/201.htm#ep1097220). Note: - ‘IRREGULAR` is unsupported as of 2/1/2025 and will no longer return. - `NON_MACHINABLE` is unsupported as of 2/1/2025 and will no longer return.

Constant Summary collapse

PROCESSING_CATEGORY6 =
[
  # 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
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = FLATS) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'flats' then FLATS
  when 'machinable' then MACHINABLE
  when 'irregular' then IRREGULAR
  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_category6.rb', line 30

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

  PROCESSING_CATEGORY6.include?(value)
end