Class: UspsApi::ProcessingCategory7

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

Overview

The type of packages that will be nested to the container. ‘MIXED` is only available for `DESTINATION_DELIVERY_UNIT` containers.

Constant Summary collapse

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

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



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/usps_api/models/processing_category7.rb', line 27

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 'nonstandard' then NONSTANDARD
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/usps_api/models/processing_category7.rb', line 21

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

  PROCESSING_CATEGORY7.include?(value)
end