Class: UspsApi::ContentType

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

Overview

The type of contents in the package. Note: * ‘CREMATED_REMAINS` is currently only eligible for the `PRIORITY_MAIL_EXPRESS` mail class and is not eligible for Hold for Pickup shipments. Please refer to [Publication 139](about.usps.com/publications/pub139/welcome.htm) for guidelines on how to package and ship `CREMATED_REMAINS`. * `DAY_OLD_POULTRY` is currently only eligible with mail class values of `USPS_GROUND_ADVANTAGE`, `PRIORITY_MAIL` and `PRIORITY_MAIL_EXPRESS`. * Shipments that contain Live Animals or Perishables will incur a Live Animal and Perishables Handling Fee per mail piece. Content types `HAZMAT`, `CREMATED_REMAINS`, and `MEDICAL_SUPPLIES` do not apply and will not incur a fee. For `DAY_OLD_POULTRY` shipments only, an additional Live Animal Transport Fee per pound is applied. For more information, please visit [Live Animals Transportation Fee FAQ](faq.usps.com/s/article/Live-Animal-Transportation-Fee#:~:text=T he%20Live%20Animal%20Transportation%20fee%20is%20charged%20%240.20%20per%20p ound,prices%20to%20Zones%205%2D9) * `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 Perishable and Hazardous Material, please refer to [Publication 52](pe.usps.com/text/pub52/welcome.htm). * For ZIP codes with restrictions: * Please refer to the most recent [Postal Bulletin](about.usps.com/resources/postal-bulletin.htm) ZIP restriction table for more information. You can find this data under `Pull-Out information` -> `Other Information` -> `Overseas Military/Diplomatic Mail`. * When restriction `M` applies, then `BEES`, `DAY_OLD_POULTRY`, `ADULT_BIRDS`, `OTHER_LIVES`, `FRUITS`, `VEGETABLES`, and `LIVE_PLANTS` are not allowed. * When restriction `X` applies, then `CREMATED_REMAINS` are not allowed.

Constant Summary collapse

CONTENT_TYPE =
[
  # 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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/usps_api/models/content_type.rb', line 85

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



79
80
81
82
83
# File 'lib/usps_api/models/content_type.rb', line 79

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

  CONTENT_TYPE.include?(value)
end