Class: WMATA::StationEntrance
- Defined in:
- lib/resources/station_entrance.rb
Overview
A resource class representing a station entrance (even if it’s just an elevator).
Available attribute methods:
-
id
- ID of the entrance. -
name
- The name of the entrance. -
description
- A description of the entrance. -
lat
- The entrance’s latitude. -
lon
- The entrance’s longitude.
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #coordinates ⇒ Object (also: #coords)
- #latitude ⇒ Object
- #longitude ⇒ Object
-
#station ⇒ Object
Get the
Station
instance for this entrance. -
#station_codes ⇒ Object
Get station codes that this entrance serves.
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
Instance Method Details
#coordinates ⇒ Object Also known as: coords
34 35 36 |
# File 'lib/resources/station_entrance.rb', line 34 def coordinates [latitude, longitude] end |
#latitude ⇒ Object
26 27 28 |
# File 'lib/resources/station_entrance.rb', line 26 def latitude @attrs['Lat'] end |
#longitude ⇒ Object
30 31 32 |
# File 'lib/resources/station_entrance.rb', line 30 def longitude @attrs['Lon'] end |
#station ⇒ Object
Get the Station
instance for this entrance.
22 23 24 |
# File 'lib/resources/station_entrance.rb', line 22 def station @station ||= Station.get(station_codes.first) end |
#station_codes ⇒ Object
Get station codes that this entrance serves.
17 18 19 |
# File 'lib/resources/station_entrance.rb', line 17 def station_codes [@attrs['StationCode1'], @attrs['StationCode2']].compact end |