gtfs-engine 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +37 -0
- data/app/controllers/gtfs_engine/agencies_controller.rb +24 -0
- data/app/controllers/gtfs_engine/application_controller.rb +21 -0
- data/app/controllers/gtfs_engine/calendar_dates_controller.rb +22 -0
- data/app/controllers/gtfs_engine/calendars_controller.rb +51 -0
- data/app/controllers/gtfs_engine/data_sets_controller.rb +47 -0
- data/app/controllers/gtfs_engine/fare_attributes_controller.rb +27 -0
- data/app/controllers/gtfs_engine/fare_rules_controller.rb +26 -0
- data/app/controllers/gtfs_engine/feed_infos_controller.rb +26 -0
- data/app/controllers/gtfs_engine/frequencies_controller.rb +26 -0
- data/app/controllers/gtfs_engine/routes_controller.rb +25 -0
- data/app/controllers/gtfs_engine/shapes_controller.rb +23 -0
- data/app/controllers/gtfs_engine/stop_times_controller.rb +28 -0
- data/app/controllers/gtfs_engine/stops_controller.rb +30 -0
- data/app/controllers/gtfs_engine/transfers_controller.rb +38 -0
- data/app/controllers/gtfs_engine/trips_controller.rb +34 -0
- data/app/helpers/gtfs_engine/default_views_helper.rb +42 -0
- data/app/helpers/gtfs_engine/fields_helper.rb +32 -0
- data/app/models/gtfs_engine/agency.rb +19 -0
- data/app/models/gtfs_engine/calendar.rb +78 -0
- data/app/models/gtfs_engine/calendar_date.rb +20 -0
- data/app/models/gtfs_engine/data_set.rb +73 -0
- data/app/models/gtfs_engine/fare_attribute.rb +19 -0
- data/app/models/gtfs_engine/fare_rule.rb +28 -0
- data/app/models/gtfs_engine/feed_info.rb +19 -0
- data/app/models/gtfs_engine/frequency.rb +20 -0
- data/app/models/gtfs_engine/route.rb +24 -0
- data/app/models/gtfs_engine/shape.rb +20 -0
- data/app/models/gtfs_engine/stop.rb +26 -0
- data/app/models/gtfs_engine/stop_time.rb +21 -0
- data/app/models/gtfs_engine/transfer.rb +23 -0
- data/app/models/gtfs_engine/trip.rb +27 -0
- data/app/views/gtfs_engine/calendars/dates.json.jbuilder +18 -0
- data/app/views/gtfs_engine/data_sets/index.json.jbuilder +28 -0
- data/app/views/gtfs_engine/data_sets/show.json.jbuilder +21 -0
- data/app/views/gtfs_engine/gtfs/index.json.jbuilder +15 -0
- data/app/views/gtfs_engine/gtfs/show.json.jbuilder +15 -0
- data/app/views/gtfs_engine/transfers/from.json.jbuilder +15 -0
- data/app/views/gtfs_engine/transfers/from_to.json.jbuilder +15 -0
- data/app/views/gtfs_engine/transfers/to.json.jbuilder +15 -0
- data/app/views/gtfs_engine/trips/block.json.jbuilder +15 -0
- data/bin/rails +8 -0
- data/config/initializers/extensions_loader.rb +15 -0
- data/config/routes.rb +45 -0
- data/db/migrate/20140320045108_create_gtfs_engine_data_sets.rb +17 -0
- data/db/migrate/20140320045232_create_gtfs_engine_calendars.rb +24 -0
- data/db/migrate/20140320045751_create_gtfs_engine_calendar_dates.rb +16 -0
- data/db/migrate/20140320050100_create_gtfs_engine_shapes.rb +20 -0
- data/db/migrate/20140320051140_create_gtfs_engine_routes.rb +22 -0
- data/db/migrate/20140320052005_create_gtfs_engine_stops.rb +28 -0
- data/db/migrate/20140320052508_create_gtfs_engine_trips.rb +26 -0
- data/db/migrate/20140320052907_create_gtfs_engine_stop_times.rb +24 -0
- data/db/migrate/20140401032609_create_gtfs_engine_agencies.rb +19 -0
- data/db/migrate/20140405235947_create_gtfs_engine_fare_attributes.rb +18 -0
- data/db/migrate/20140406063500_create_gtfs_engine_fare_rules.rb +17 -0
- data/db/migrate/20140406071922_create_gtfs_engine_frequencies.rb +17 -0
- data/db/migrate/20140406072309_create_gtfs_engine_transfers.rb +17 -0
- data/db/migrate/20140406073548_create_gtfs_engine_feed_infos.rb +16 -0
- data/lib/ext.rb +19 -0
- data/lib/ext/active_record/associations/association.rb +41 -0
- data/lib/gtfs_engine.rb +33 -0
- data/lib/gtfs_engine/concerns.rb +19 -0
- data/lib/gtfs_engine/concerns/controllers.rb +20 -0
- data/lib/gtfs_engine/concerns/controllers/data_access.rb +31 -0
- data/lib/gtfs_engine/concerns/controllers/gtfs.rb +158 -0
- data/lib/gtfs_engine/engine.rb +28 -0
- data/lib/gtfs_engine/exceptions.rb +35 -0
- data/lib/gtfs_engine/json_responder.rb +31 -0
- data/lib/gtfs_engine/sources.rb +86 -0
- data/lib/gtfs_engine/version.rb +84 -0
- data/lib/tasks/gtfs_engine_tasks.rake +89 -0
- metadata +242 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
module GtfsEngine
|
16
|
+
class Shape < ActiveRecord::Base
|
17
|
+
belongs_to :data_set, inverse_of: :shapes
|
18
|
+
belongs_to :trip, inverse_of: :shapes, shared_key: :shape_id
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
module GtfsEngine
|
16
|
+
class Stop < ActiveRecord::Base
|
17
|
+
belongs_to :data_set, inverse_of: :stops
|
18
|
+
|
19
|
+
has_many :stop_time, inverse_of: :stop, shared_key: :stop_id
|
20
|
+
|
21
|
+
with_options foreign_key: :origin_id, primary_key: :zone_id do
|
22
|
+
has_many :origin_rules, inverse_of: :stop, class_name: 'fare_rule'
|
23
|
+
has_many :destination_rules, inverse_of: :stop, class_name: 'fare_rule'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
module GtfsEngine
|
16
|
+
class StopTime < ActiveRecord::Base
|
17
|
+
belongs_to :data_set, inverse_of: :stop_times
|
18
|
+
belongs_to :trip, inverse_of: :stop_times, shared_key: :trip_id
|
19
|
+
belongs_to :stop, inverse_of: :stop_time, shared_key: :stop_id
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
module GtfsEngine
|
16
|
+
class Transfer < ActiveRecord::Base
|
17
|
+
belongs_to :data_set, inverse_of: :transfers
|
18
|
+
belongs_to :from_stop, inverse_of: :from_transfers,
|
19
|
+
foreign_key: :stop_id, primary_key: :from_stop_id
|
20
|
+
belongs_to :to_stop, inverse_of: :from_transfers,
|
21
|
+
foreign_key: :stop_id, primary_key: :to_stop_id
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
module GtfsEngine
|
16
|
+
class Trip < ActiveRecord::Base
|
17
|
+
belongs_to :data_set, inverse_of: :trips
|
18
|
+
belongs_to :route, inverse_of: :trips, shared_key: :route_id
|
19
|
+
belongs_to :calendar, inverse_of: :trips, shared_key: :service_id
|
20
|
+
|
21
|
+
has_many :frequencies, inverse_of: :trip, shared_key: :trip_id
|
22
|
+
has_many :shapes, inverse_of: :trip, shared_key: :shape_id
|
23
|
+
has_many :stop_times, inverse_of: :trip, shared_key: :trip_id
|
24
|
+
|
25
|
+
has_many :stops, through: :stop_times
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
json.ignore_nil! true
|
16
|
+
json.array! @dates do |dates|
|
17
|
+
json.extract! dates, *%i(service_id date exception_type)
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
json.ignore_nil! true
|
16
|
+
|
17
|
+
json.status 'success'
|
18
|
+
json.data do
|
19
|
+
json.data_sets do
|
20
|
+
@data_sets.each do |name, sets|
|
21
|
+
json.set! name do
|
22
|
+
json.array! sets do |set|
|
23
|
+
json.extract! set, *%i(id name title url etag created_at)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
json.status 'success'
|
16
|
+
json.data do
|
17
|
+
json.set! 'data_set' do
|
18
|
+
json.extract! @data_set, *%i(id name title url etag created_at)
|
19
|
+
json.details @data_set.details
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
index json, @records
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
show json, @record
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
index json, @transfers
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
show json, @transfer
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
index json, @transfers
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
index json, @trips
|
data/bin/rails
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/gtfs_engine/engine', __FILE__)
|
6
|
+
|
7
|
+
require 'rails/all'
|
8
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
require 'ext'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# This file is part of the KNOWtime server.
|
2
|
+
#
|
3
|
+
# The KNOWtime server is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# The KNOWtime server is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with the KNOWtime server. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
GtfsEngine::Engine.routes.draw do
|
16
|
+
with_options only: [:index, :show], defaults: {format: :json} do |r|
|
17
|
+
|
18
|
+
r.resources :data_sets, path: '' do
|
19
|
+
r.resources :agencies
|
20
|
+
r.resources :stops
|
21
|
+
r.resources :routes
|
22
|
+
r.resources :trips, only: [:show] do
|
23
|
+
collection { get 'block/:id', action: :block }
|
24
|
+
end
|
25
|
+
r.resources :stop_times
|
26
|
+
r.resources :calendars do
|
27
|
+
collection { get 'for_date/:YYYY_MM_DD', action: :for_date }
|
28
|
+
member { get :dates }
|
29
|
+
end
|
30
|
+
r.resources :calendar_dates
|
31
|
+
r.resources :fare_attributes
|
32
|
+
r.resources :fare_rules
|
33
|
+
r.resources :shapes, only: [:show]
|
34
|
+
r.resources :frequencies
|
35
|
+
r.resources :transfers, only: [:index] do
|
36
|
+
collection do
|
37
|
+
get 'from/:stop_id', action: :from
|
38
|
+
get 'to/:stop_id', action: :to
|
39
|
+
get 'from/:from_id/to/:to_id', action: :from_to
|
40
|
+
end
|
41
|
+
end
|
42
|
+
r.resources :feed_infos, only: [:index]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateGtfsEngineDataSets < ActiveRecord::Migration
|
2
|
+
TABLE = :gtfs_engine_data_sets
|
3
|
+
|
4
|
+
def change
|
5
|
+
create_table TABLE do |t|
|
6
|
+
t.string :name, null: false
|
7
|
+
t.string :title, null: false
|
8
|
+
t.string :url, null: false
|
9
|
+
t.string :etag, null: false
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index TABLE, :name
|
15
|
+
add_index TABLE, :url
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateGtfsEngineCalendars < ActiveRecord::Migration
|
2
|
+
TABLE = :gtfs_engine_calendars
|
3
|
+
|
4
|
+
def change
|
5
|
+
create_table TABLE do |t|
|
6
|
+
t.string :service_id, null: false
|
7
|
+
t.boolean :monday, null: false
|
8
|
+
t.boolean :tuesday, null: false
|
9
|
+
t.boolean :wednesday, null: false
|
10
|
+
t.boolean :thursday, null: false
|
11
|
+
t.boolean :friday, null: false
|
12
|
+
t.boolean :saturday, null: false
|
13
|
+
t.boolean :sunday, null: false
|
14
|
+
t.date :start_date, null: false
|
15
|
+
t.date :end_date, null: false
|
16
|
+
|
17
|
+
t.references :data_set, null: false, index: true
|
18
|
+
end
|
19
|
+
|
20
|
+
add_index TABLE, :service_id
|
21
|
+
add_index TABLE, :start_date
|
22
|
+
add_index TABLE, :end_date
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateGtfsEngineCalendarDates < ActiveRecord::Migration
|
2
|
+
TABLE = :gtfs_engine_calendar_dates
|
3
|
+
|
4
|
+
def change
|
5
|
+
create_table TABLE do |t|
|
6
|
+
t.string :service_id, null: false
|
7
|
+
t.date :date, null: false
|
8
|
+
t.integer :exception_type, null: false
|
9
|
+
|
10
|
+
t.references :data_set, null: false, index: true
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index TABLE, :service_id
|
14
|
+
add_index TABLE, :date
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateGtfsEngineShapes < ActiveRecord::Migration
|
2
|
+
TABLE = :gtfs_engine_shapes
|
3
|
+
|
4
|
+
def change
|
5
|
+
create_table TABLE do |t|
|
6
|
+
t.string :shape_id, null: false
|
7
|
+
t.float :shape_pt_lat, null: false
|
8
|
+
t.float :shape_pt_lon, null: false
|
9
|
+
t.integer :shape_pt_sequence, null: false
|
10
|
+
t.float :shape_dist_traveled
|
11
|
+
|
12
|
+
t.references :data_set, null: false, index: true
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index TABLE, :shape_id
|
16
|
+
add_index TABLE, :shape_pt_sequence
|
17
|
+
add_index TABLE, :shape_pt_lat
|
18
|
+
add_index TABLE, :shape_pt_lon
|
19
|
+
end
|
20
|
+
end
|