Class: UspsApi::ElotCode
- Inherits:
-
Object
- Object
- UspsApi::ElotCode
- Defined in:
- lib/usps_api/models/elot_code.rb
Overview
eLOT Ascending/Descending Code * ‘A` - eLOT Number Ascending * `D` - eLOT Number Descending
Constant Summary collapse
- ELOT_CODE =
[ # TODO: Write general description for A A = 'A'.freeze, # TODO: Write general description for D D = 'D'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = A) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/usps_api/models/elot_code.rb', line 24 def self.from_value(value, default_value = A) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'a' then A when 'd' then D else default_value end end |
.validate(value) ⇒ Object
18 19 20 21 22 |
# File 'lib/usps_api/models/elot_code.rb', line 18 def self.validate(value) return false if value.nil? ELOT_CODE.include?(value) end |