Class: UspsApi::CustomsContentType1
- Inherits:
-
Object
- Object
- UspsApi::CustomsContentType1
- Defined in:
- lib/usps_api/models/customs_content_type1.rb
Overview
Specifies the content of the package or envelope. * MERCHANDISE * GIFT * DOCUMENT * COMMERCIAL_SAMPLE * RETURNED_GOODS * OTHER * HUMANITARIAN_DONATIONS * DANGEROUS_GOODS
Constant Summary collapse
- CUSTOMS_CONTENT_TYPE1 =
[ # 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 ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = MERCHANDISE) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/usps_api/models/customs_content_type1.rb', line 43 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 else default_value end end |
.validate(value) ⇒ Object
37 38 39 40 41 |
# File 'lib/usps_api/models/customs_content_type1.rb', line 37 def self.validate(value) return false if value.nil? CUSTOMS_CONTENT_TYPE1.include?(value) end |