Class: UspsApi::Program
- Inherits:
-
Object
- Object
- UspsApi::Program
- Defined in:
- lib/usps_api/models/program.rb
Overview
The program (Outbound or Returns) in which the MID is enrolled. If the MID is enrolled in both programs, two objects will be returned, one for each program.
Constant Summary collapse
- PROGRAM =
[ # TODO: Write general description for OUTBOUND OUTBOUND = 'OUTBOUND'.freeze, # TODO: Write general description for RETURNS RETURNS = 'RETURNS'.freeze, # TODO: Write general description for NONE NONE = 'NONE'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = OUTBOUND) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/usps_api/models/program.rb', line 28 def self.from_value(value, default_value = OUTBOUND) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'outbound' then OUTBOUND when 'returns' then RETURNS when 'none' then NONE else default_value end end |
.validate(value) ⇒ Object
22 23 24 25 26 |
# File 'lib/usps_api/models/program.rb', line 22 def self.validate(value) return false if value.nil? PROGRAM.include?(value) end |