Class: UspsApi::EtaStatus
- Inherits:
-
Object
- Object
- UspsApi::EtaStatus
- Defined in:
- lib/usps_api/models/eta_status.rb
Overview
The ETA status of the current destination and not the appointment. Required unless currentEvent.eventType is FACILITY_ARRIVE or FACILITY_DEPART.
Constant Summary collapse
- ETA_STATUS =
[ # TODO: Write general description for ON_TIME ON_TIME = 'ON_TIME'.freeze, # TODO: Write general description for EARLY EARLY = 'EARLY'.freeze, # TODO: Write general description for DELAYED DELAYED = 'DELAYED'.freeze, # TODO: Write general description for LATE LATE = 'LATE'.freeze, # TODO: Write general description for CANCELLED CANCELLED = 'CANCELLED'.freeze, # TODO: Write general description for REDIRECTED REDIRECTED = 'REDIRECTED'.freeze, # TODO: Write general description for RESCHEDULED RESCHEDULED = 'RESCHEDULED'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ON_TIME) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/usps_api/models/eta_status.rb', line 39 def self.from_value(value, default_value = ON_TIME) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'on_time' then ON_TIME when 'early' then EARLY when 'delayed' then DELAYED when 'late' then LATE when 'cancelled' then CANCELLED when 'redirected' then REDIRECTED when 'rescheduled' then RESCHEDULED else default_value end end |
.validate(value) ⇒ Object
33 34 35 36 37 |
# File 'lib/usps_api/models/eta_status.rb', line 33 def self.validate(value) return false if value.nil? ETA_STATUS.include?(value) end |