Class: UspsApi::ContainerMailClass
- Inherits:
-
Object
- Object
- UspsApi::ContainerMailClass
- Defined in:
- lib/usps_api/models/container_mail_class.rb
Overview
Mail class for the Open and Distribute container
Constant Summary collapse
- CONTAINER_MAIL_CLASS =
[ # TODO: Write general description for PRIORITY_MAIL PRIORITY_MAIL = 'PRIORITY_MAIL'.freeze, # TODO: Write general description for PRIORITY_MAIL_EXPRESS PRIORITY_MAIL_EXPRESS = 'PRIORITY_MAIL_EXPRESS'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = PRIORITY_MAIL) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/usps_api/models/container_mail_class.rb', line 23 def self.from_value(value, default_value = PRIORITY_MAIL) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'priority_mail' then PRIORITY_MAIL when 'priority_mail_express' then PRIORITY_MAIL_EXPRESS else default_value end end |
.validate(value) ⇒ Object
17 18 19 20 21 |
# File 'lib/usps_api/models/container_mail_class.rb', line 17 def self.validate(value) return false if value.nil? CONTAINER_MAIL_CLASS.include?(value) end |