Class: UspsApi::ImcbContainerType

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

Overview

IMcb Container Type requested. When not provided, this will take the value of impbContainerType by default. This field is not applicable when impbContainerType is ‘OPEN_DISTRIBUTE_PALLET’.

Constant Summary collapse

IMCB_CONTAINER_TYPE =
[
  # TODO: Write general description for OPEN_DISTRIBUTE_FULL_POSTAL_PAKS
  OPEN_DISTRIBUTE_FULL_POSTAL_PAKS = 'OPEN_DISTRIBUTE_FULL_POSTAL_PAKS'.freeze,

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OPEN_DISTRIBUTE_FULL_POSTAL_PAKS) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'open_distribute_full_postal_paks' then OPEN_DISTRIBUTE_FULL_POSTAL_PAKS
  when 'open_distribute_half_tray_box' then OPEN_DISTRIBUTE_HALF_TRAY_BOX
  when 'open_distribute_half_postal_paks' then OPEN_DISTRIBUTE_HALF_POSTAL_PAKS
  when 'open_distribute_full_tray_box' then OPEN_DISTRIBUTE_FULL_TRAY_BOX
  when 'open_distribute_emm_tray_box' then OPEN_DISTRIBUTE_EMM_TRAY_BOX
  when 'open_distribute_flat_tub_tray_box' then OPEN_DISTRIBUTE_FLAT_TUB_TRAY_BOX
  when 'sack' then SACK
  else
    default_value
  end
end

.validate(value) ⇒ Object



34
35
36
37
38
# File 'lib/usps_api/models/imcb_container_type.rb', line 34

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

  IMCB_CONTAINER_TYPE.include?(value)
end