Class: WMATA::ElevatorIncident
- Defined in:
- lib/resources/elevator_incident.rb
Overview
A class representing service incidents in elevators (e.g., an elevator is busted going between the two floors of the station).
Available attribute methods:
-
display_order
- Display priority -
date_out_of_service
- Date when elevator/escalator was switched off. -
date_updated
- Time when the information was last received. -
location_description
- Location of elevator/escalator. -
station_code
- Code of the station affected by the escalator/elevator incident. -
station_name
- Name of the station affected by the escalator/elevator incident. -
symptom_code
- ID of the reason why elevator/escalator was switched off. -
symptom_description
- Information why elevator/escalator was switched off. -
time_out_of_service
- Number of minutes the elevator has been out of service until last update of data. -
unit_name
- ID of the affected elevator/escalator. -
unit_status
- Can be “C” or “O”: O means Out of service (has open issues) and C means Operational (open issues were closed). -
unit_type
- “ESCALATOR” or “ELEVATOR”
Instance Attribute Summary
Attributes inherited from Resource
Class Method Summary collapse
-
.get_by_station(affected_station) ⇒ Object
Get the incidents by station; provide either a
Station
instance or a station code as the argument.
Instance Method Summary collapse
-
#affected_station ⇒ Object
(also: #station)
Get the station affected by the problem.
-
#date_out_of_service ⇒ Object
Get a
Time
object representing the time the elevator went out of service. -
#date_updated ⇒ Object
Get a
Time
object representing the last time this API data entry was updated.
Methods inherited from Resource
endpoint, get_all, #initialize, #method_missing, service, to_query_string
Constructor Details
This class inherits a constructor from WMATA::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class WMATA::Resource
Class Method Details
.get_by_station(affected_station) ⇒ Object
Get the incidents by station; provide either a Station
instance or a station code as the argument.
26 27 28 29 |
# File 'lib/resources/elevator_incident.rb', line 26 def self.get_by_station(affected_station) @incidents ||= get_all @incidents.select {|i| i.station_code == affected_station.to_s }.pop end |
Instance Method Details
#affected_station ⇒ Object Also known as: station
Get the station affected by the problem.
32 33 34 |
# File 'lib/resources/elevator_incident.rb', line 32 def affected_station Station.get(@attrs['StationCode']) end |
#date_out_of_service ⇒ Object
Get a Time
object representing the time the elevator went out of service.
40 41 42 |
# File 'lib/resources/elevator_incident.rb', line 40 def date_out_of_service Time.parse(@attrs['DateOutOfServ']) end |
#date_updated ⇒ Object
Get a Time
object representing the last time this API data entry was updated.
46 47 48 |
# File 'lib/resources/elevator_incident.rb', line 46 def date_updated Time.parse(@attrs['DateUpdated']) end |