Class: UspsApi::ProcessingCategory2

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

Overview

The type of packages that will be nested to the container. ‘MIXED` is only available for `DESTINATION_DELIVERY_UNIT` and `DESTINATION_SERVICE_HUB` containers. Note: * `NON_MACHINABLE` is deprecated and will convert to `NONSTANDARD` as of 01/19/2025.

Constant Summary collapse

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

  # TODO: Write general description for MIXED
  MIXED = 'MIXED'.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 = MACHINABLE) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/usps_api/models/processing_category2.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'machinable' then MACHINABLE
  when 'mixed' then MIXED
  when 'non_machinable' then NON_MACHINABLE
  when 'nonstandard' then NONSTANDARD
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/usps_api/models/processing_category2.rb', line 26

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

  PROCESSING_CATEGORY2.include?(value)
end