blob: d02781cfa70f7d696c9008fd07b9b72aa18468df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
object @journey_pattern
extends "api/v1/trident_objects/show"
[:id, :name, :published_name, :registration_number, :comment, :checksum, :custom_fields].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
node :full_schedule do |journey_pattern|
journey_pattern.full_schedule?
end
if has_feature? :costs_in_journey_patterns
attribute :costs
end
node(:route_short_description) do |journey_pattern|
partial("api/v1/routes/short_description", :object => journey_pattern.route)
end
node(:vehicle_journey_object_ids) do |journey_pattern|
journey_pattern.vehicle_journeys.pluck(:objectid)
end unless root_object.vehicle_journeys.empty?
child :stop_points => :stop_area_short_descriptions do |stop_points|
node do |stop_point|
cache stop_point.stop_area_id
partial("api/v1/stop_areas/short_description", :object => stop_point.stop_area)
end
end
|