Class: UspsApi::PalletType

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

Overview

Pallet type used to house handing units. Required for Create actions.

Constant Summary collapse

PALLET_TYPE =
[
  # TODO: Write general description for AIRBOX
  AIRBOX = 'AIRBOX'.freeze,

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

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = AIRBOX) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/usps_api/models/pallet_type.rb', line 41

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

  str = value.to_s.strip

  case str.downcase
  when 'airbox' then AIRBOX
  when 'pallet' then PALLET
  when 'eirs_61' then EIRS_61
  when 'eirs_61p' then EIRS_61P
  when 'eirs_66' then EIRS_66
  when 'eirs_68' then EIRS_68
  when 'eirs_84' then EIRS_84
  when 'eirs_84c' then EIRS_84C
  else
    default_value
  end
end

.validate(value) ⇒ Object



35
36
37
38
39
# File 'lib/usps_api/models/pallet_type.rb', line 35

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

  PALLET_TYPE.include?(value)
end