Class: UspsApi::ProcessingCategoryName
- Inherits:
-
Object
- Object
- UspsApi::ProcessingCategoryName
- Defined in:
- lib/usps_api/models/processing_category_name.rb
Overview
A name representing the processing category associated to a shipment.
Constant Summary collapse
- PROCESSING_CATEGORY_NAME =
[ # TODO: Write general description for CARDS CARDS = 'CARDS'.freeze, # TODO: Write general description for LETTERS LETTERS = 'LETTERS'.freeze, # TODO: Write general description for FLATS FLATS = 'FLATS'.freeze, # TODO: Write general description for MACHINABLE_PARCEL MACHINABLE_PARCEL = 'MACHINABLE_PARCEL'.freeze, # TODO: Write general description for IRREGULAR_PARCEL IRREGULAR_PARCEL = 'IRREGULAR_PARCEL'.freeze, # TODO: Write general description for NONSTANDARD_PARCEL NONSTANDARD_PARCEL = 'NONSTANDARD_PARCEL'.freeze, # TODO: Write general description for CATALOGS CATALOGS = 'CATALOGS'.freeze, # TODO: Write general description for OPEN_AND_DISTRIBUTE OPEN_AND_DISTRIBUTE = 'OPEN_AND_DISTRIBUTE'.freeze, # TODO: Write general description for RETURNS RETURNS = 'RETURNS'.freeze, # TODO: Write general description for SOFT_PACK_MACHINABLE SOFT_PACK_MACHINABLE = 'SOFT_PACK_MACHINABLE'.freeze, # TODO: Write general description for SOFT_PACK_NON_MACHINABLE SOFT_PACK_NON_MACHINABLE = 'SOFT_PACK_NON_MACHINABLE'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = CARDS) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/usps_api/models/processing_category_name.rb', line 50 def self.from_value(value, default_value = CARDS) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'cards' then CARDS when 'letters' then LETTERS when 'flats' then FLATS when 'machinable_parcel' then MACHINABLE_PARCEL when 'irregular_parcel' then IRREGULAR_PARCEL when 'nonstandard_parcel' then NONSTANDARD_PARCEL when 'catalogs' then CATALOGS when 'open_and_distribute' then OPEN_AND_DISTRIBUTE when 'returns' then RETURNS when 'soft_pack_machinable' then SOFT_PACK_MACHINABLE when 'soft_pack_non_machinable' then SOFT_PACK_NON_MACHINABLE else default_value end end |
.validate(value) ⇒ Object
44 45 46 47 48 |
# File 'lib/usps_api/models/processing_category_name.rb', line 44 def self.validate(value) return false if value.nil? PROCESSING_CATEGORY_NAME.include?(value) end |