Class: UspsApi::ContentType1

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

Overview

The type of contents in the package. * HAZMAT * CREMATED_REMAINS * BEES * DAY_OLD_POULTRY * ADULT_BIRDS * OTHER_LIVES * PERISHABLE * PHARMACEUTICALS * MEDICAL_SUPPLIES * FRUITS * VEGETABLES * LIVE_PLANTS Note: * ‘CREMATED_REMAINS` is currently only eligible for the `PRIORITY_MAIL_EXPRESS_RETURN_SERVICE` mail class. Please refer to [Publication 139](about.usps.com/publications/pub139/welcome.htm) for guidelines on how to package and ship `CREMATED_REMAINS`. * `HAZMAT` domestic labels with destination addresses to APO/FPO/DPO and PTFAS (except Puerto Rico) will not contain any Hazmat markings/indicators, including service type codes in the IMpb. When users indicate a shipment contains hazmat materials in the API request (via content type and/or extra services), that information will still be captured and sent in the shipping services file. For more information, please review the [USPS APIs release notes](postalpro.usps.gov/usps-apis-releases) * For guidelines on shipping Hazardous Material, please refer to [Publication 52](pe.usps.com/text/pub52/welcome.htm).

Constant Summary collapse

CONTENT_TYPE1 =
[
  # TODO: Write general description for HAZMAT
  HAZMAT = 'HAZMAT'.freeze,

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

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

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

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

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

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = HAZMAT) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/usps_api/models/content_type1.rb', line 68

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

  str = value.to_s.strip

  case str.downcase
  when 'hazmat' then HAZMAT
  when 'cremated_remains' then CREMATED_REMAINS
  when 'bees' then BEES
  when 'day_old_poultry' then DAY_OLD_POULTRY
  when 'adult_birds' then ADULT_BIRDS
  when 'other_lives' then OTHER_LIVES
  when 'perishable' then PERISHABLE
  when 'pharmaceuticals' then PHARMACEUTICALS
  when 'medical_supplies' then MEDICAL_SUPPLIES
  when 'fruits' then FRUITS
  when 'vegetables' then VEGETABLES
  when 'live_plants' then LIVE_PLANTS
  else
    default_value
  end
end

.validate(value) ⇒ Object



62
63
64
65
66
# File 'lib/usps_api/models/content_type1.rb', line 62

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

  CONTENT_TYPE1.include?(value)
end