Class: UspsApi::CustomsContentType
- Inherits:
-
Object
- Object
- UspsApi::CustomsContentType
- Defined in:
- lib/usps_api/models/customs_content_type.rb
Overview
Specifies the content of the package or envelope. Note: * ‘CREMATED_REMAINS` is only supported by mailClass `PRIORITY_MAIL_EXPRESS_INTERNATIONAL` * Customs Content Type must be `DANGEROUS_GOODS` when using any of the following extra services: * 813 - HAZMAT Class 7 - Radioactive Materials Package * 826 - HAZMAT Division 6.2 – Infectious Substances Package
Constant Summary collapse
- CUSTOMS_CONTENT_TYPE =
[ # TODO: Write general description for MERCHANDISE MERCHANDISE = 'MERCHANDISE'.freeze, # TODO: Write general description for GIFT GIFT = 'GIFT'.freeze, # TODO: Write general description for DOCUMENT DOCUMENT = 'DOCUMENT'.freeze, # TODO: Write general description for COMMERCIAL_SAMPLE COMMERCIAL_SAMPLE = 'COMMERCIAL_SAMPLE'.freeze, # TODO: Write general description for RETURNED_GOODS RETURNED_GOODS = 'RETURNED_GOODS'.freeze, # TODO: Write general description for OTHER OTHER = 'OTHER'.freeze, # TODO: Write general description for HUMANITARIAN_DONATIONS HUMANITARIAN_DONATIONS = 'HUMANITARIAN_DONATIONS'.freeze, # TODO: Write general description for DANGEROUS_GOODS DANGEROUS_GOODS = 'DANGEROUS_GOODS'.freeze, # TODO: Write general description for CREMATED_REMAINS CREMATED_REMAINS = 'CREMATED_REMAINS'.freeze, # TODO: Write general description for NON_NEGOTIABLE_DOCUMENT NON_NEGOTIABLE_DOCUMENT = 'NON_NEGOTIABLE_DOCUMENT'.freeze, # TODO: Write general description for MEDICAL_SUPPLIES MEDICAL_SUPPLIES = 'MEDICAL_SUPPLIES'.freeze, # TODO: Write general description for PHARMACEUTICALS PHARMACEUTICALS = 'PHARMACEUTICALS'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = MERCHANDISE) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/usps_api/models/customs_content_type.rb', line 58 def self.from_value(value, default_value = MERCHANDISE) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'merchandise' then MERCHANDISE when 'gift' then GIFT when 'document' then DOCUMENT when 'commercial_sample' then COMMERCIAL_SAMPLE when 'returned_goods' then RETURNED_GOODS when 'other' then OTHER when 'humanitarian_donations' then HUMANITARIAN_DONATIONS when 'dangerous_goods' then DANGEROUS_GOODS when 'cremated_remains' then CREMATED_REMAINS when 'non_negotiable_document' then NON_NEGOTIABLE_DOCUMENT when 'medical_supplies' then MEDICAL_SUPPLIES when 'pharmaceuticals' then PHARMACEUTICALS else default_value end end |
.validate(value) ⇒ Object
52 53 54 55 56 |
# File 'lib/usps_api/models/customs_content_type.rb', line 52 def self.validate(value) return false if value.nil? CUSTOMS_CONTENT_TYPE.include?(value) end |