Class: Transilien::StopPoint
Constant Summary
Constants inherited
from MicroService
MicroService::API_HOST, MicroService::API_URI, MicroService::Default_cache_duration
Instance Attribute Summary
Attributes inherited from MicroService
#access_time, #external_code, #name, #payload
Instance Method Summary
collapse
action, action_component, action_instance_xpath, action_param, add_filters, cache_it, cache_keys, errors, filters, filters=, find, find_from_full_query_cache, find_from_query_caches, from_node, http, params, #to_s
Instance Method Details
#address ⇒ Object
Also known as:
stop_point_address
6
7
8
|
# File 'lib/transilien/stop_point.rb', line 6
def address
payload.at('StopPointAddress')
end
|
#city ⇒ Object
26
27
28
|
# File 'lib/transilien/stop_point.rb', line 26
def city
@city ||= Transilien::City.from_node(payload.at('City'), access_time)
end
|
#coord ⇒ Object
35
36
37
38
39
40
|
# File 'lib/transilien/stop_point.rb', line 35
def coord
@coord ||= {
x: payload.at('Coord').at('CoordX').content.sub(',','.').to_f,
y: payload.at('Coord').at('CoordY').content.sub(',','.').to_f
}
end
|
#equipment ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/transilien/stop_point.rb', line 11
def equipment
@equipment ||= {
sheltered: (payload.at('Equipment')['Sheltered'] == 'True'),
mimp_access: (payload.at('Equipment')['MIPAccess'] == 'True'),
elevator: (payload.at('Equipment')['Elevator'] == 'True'),
escalator: (payload.at('Equipment')['Escalator'] == 'True'),
bike_accepted: (payload.at('Equipment')['BikeAccepted'] == 'True'),
bike_depot: (payload.at('Equipment')['BikeDepot'] == 'True')
}
end
|
#fare_zone ⇒ Object
2
3
4
|
# File 'lib/transilien/stop_point.rb', line 2
def fare_zone
@fare_zone ||= payload['FareZone']
end
|
#mode ⇒ Object
22
23
24
|
# File 'lib/transilien/stop_point.rb', line 22
def mode
@mode ||= Transilien::Mode.from_node(payload.at('Mode'), access_time)
end
|
#stop_area ⇒ Object
30
31
32
33
|
# File 'lib/transilien/stop_point.rb', line 30
def stop_area
@stop_area ||= Transilien::StopArea.find(stop_area_external_code: payload.at('StopArea')['StopAreaExternalCode']).first
end
|