gtfs_engine 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/gtfs_engine/calendar.rb +4 -2
- data/app/models/gtfs_engine/calendar_date.rb +2 -1
- data/app/models/gtfs_engine/fare_rule.rb +4 -2
- data/app/models/gtfs_engine/frequency.rb +2 -1
- data/app/models/gtfs_engine/route.rb +2 -1
- data/app/models/gtfs_engine/shape.rb +2 -1
- data/app/models/gtfs_engine/stop.rb +2 -1
- data/app/models/gtfs_engine/stop_time.rb +4 -2
- data/app/models/gtfs_engine/trip.rb +10 -5
- data/lib/gtfs_engine/version.rb +1 -1
- metadata +7 -10
- data/config/initializers/extensions_loader.rb +0 -15
- data/lib/ext.rb +0 -19
- data/lib/ext/active_record/associations/association.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c96cba6580a01ef821cde544853c5660563e0fe
|
4
|
+
data.tar.gz: bcf29b2b98379dfdcf3066261e90368ece72adb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b06887b3f22f3356dba09e22df4a5c29320beb1cd611613507849dd95f1bb28871f19b97163da11adadb0b48e7ecc232279a5b3968a3a22ffc50d3efb94491c5
|
7
|
+
data.tar.gz: a8e710faee5f1626b37a97c3123fda618b4ef17ac73be6da5f42c5053803299a5f1800bff140a89b40c33d10981237cf1c782223eba8e9aa8dae75c4690549ff
|
@@ -16,8 +16,10 @@ module GtfsEngine
|
|
16
16
|
class Calendar < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :calendars
|
18
18
|
|
19
|
-
has_many :calendar_dates, inverse_of: :calendar,
|
20
|
-
|
19
|
+
has_many :calendar_dates, inverse_of: :calendar,
|
20
|
+
foreign_key: :service_id, primary_key: :service_id
|
21
|
+
has_many :trips, inverse_of: :calendar,
|
22
|
+
foreign_key: :service_id, primary_key: :service_id
|
21
23
|
|
22
24
|
has_many :routes, through: :trips
|
23
25
|
has_many :shapes, through: :trips
|
@@ -15,6 +15,7 @@
|
|
15
15
|
module GtfsEngine
|
16
16
|
class CalendarDate < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :calendar_dates
|
18
|
-
belongs_to :calendar, inverse_of: :calendar_dates,
|
18
|
+
belongs_to :calendar, inverse_of: :calendar_dates,
|
19
|
+
foreign_key: :service_id, primary_key: :service_id
|
19
20
|
end
|
20
21
|
end
|
@@ -15,8 +15,10 @@
|
|
15
15
|
module GtfsEngine
|
16
16
|
class FareRule < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :trips
|
18
|
-
belongs_to :fare_attribute, inverse_of: :fare_rules,
|
19
|
-
|
18
|
+
belongs_to :fare_attribute, inverse_of: :fare_rules,
|
19
|
+
foreign_key: :fare_id, primary_key: :fare_id
|
20
|
+
belongs_to :route, inverse_of: :fare_rules,
|
21
|
+
foreign_key: :route_id, primary_key: :route_id
|
20
22
|
|
21
23
|
with_options class_name: 'Stop', primary_key: :zone_id do |rule|
|
22
24
|
rule.belongs_to :origin, inverse_of: :origin_rules,
|
@@ -15,6 +15,7 @@
|
|
15
15
|
module GtfsEngine
|
16
16
|
class Frequency < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :frequencies
|
18
|
-
belongs_to :trip, inverse_of: :frequencies,
|
18
|
+
belongs_to :trip, inverse_of: :frequencies,
|
19
|
+
foreign_key: :trip_id, primary_key: :trip_id
|
19
20
|
end
|
20
21
|
end
|
@@ -16,7 +16,8 @@ module GtfsEngine
|
|
16
16
|
class Route < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :routes
|
18
18
|
|
19
|
-
has_many :trips, inverse_of: :route,
|
19
|
+
has_many :trips, inverse_of: :route,
|
20
|
+
foreign_key: :route_id, primary_key: :route_id
|
20
21
|
|
21
22
|
has_many :calendars, through: :trips
|
22
23
|
has_many :shapes, through: :trips
|
@@ -15,6 +15,7 @@
|
|
15
15
|
module GtfsEngine
|
16
16
|
class Shape < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :shapes
|
18
|
-
belongs_to :trip, inverse_of: :shapes,
|
18
|
+
belongs_to :trip, inverse_of: :shapes,
|
19
|
+
foreign_key: :shape_id, primary_key: :shape_id
|
19
20
|
end
|
20
21
|
end
|
@@ -16,7 +16,8 @@ module GtfsEngine
|
|
16
16
|
class Stop < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :stops
|
18
18
|
|
19
|
-
has_many :stop_time, inverse_of: :stop,
|
19
|
+
has_many :stop_time, inverse_of: :stop,
|
20
|
+
foreign_key: :stop_id, primary_key: :stop_id
|
20
21
|
|
21
22
|
with_options foreign_key: :origin_id, primary_key: :zone_id do
|
22
23
|
has_many :origin_rules, inverse_of: :stop, class_name: 'fare_rule'
|
@@ -15,7 +15,9 @@
|
|
15
15
|
module GtfsEngine
|
16
16
|
class StopTime < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :stop_times
|
18
|
-
belongs_to :trip, inverse_of: :stop_times,
|
19
|
-
|
18
|
+
belongs_to :trip, inverse_of: :stop_times,
|
19
|
+
foreign_key: :trip_id, primary_key: :trip_id
|
20
|
+
belongs_to :stop, inverse_of: :stop_time,
|
21
|
+
foreign_key: :stop_id, primary_key: :stop_id
|
20
22
|
end
|
21
23
|
end
|
@@ -15,12 +15,17 @@
|
|
15
15
|
module GtfsEngine
|
16
16
|
class Trip < ActiveRecord::Base
|
17
17
|
belongs_to :data_set, inverse_of: :trips
|
18
|
-
belongs_to :route, inverse_of: :trips,
|
19
|
-
|
18
|
+
belongs_to :route, inverse_of: :trips,
|
19
|
+
foreign_key: :route_id, primary_key: :route_id
|
20
|
+
belongs_to :calendar, inverse_of: :trips,
|
21
|
+
foreign_key: :service_id, primary_key: :service_id
|
20
22
|
|
21
|
-
has_many :frequencies, inverse_of: :trip,
|
22
|
-
|
23
|
-
has_many :
|
23
|
+
has_many :frequencies, inverse_of: :trip,
|
24
|
+
foreign_key: :trip_id, primary_key: :trip_id
|
25
|
+
has_many :shapes, inverse_of: :trip,
|
26
|
+
foreign_key: :shape_id, primary_key: :shape_id
|
27
|
+
has_many :stop_times, inverse_of: :trip,
|
28
|
+
foreign_key: :trip_id, primary_key: :trip_id
|
24
29
|
|
25
30
|
has_many :stops, through: :stop_times
|
26
31
|
end
|
data/lib/gtfs_engine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtfs_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Sangster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: gtfs_reader
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activerecord-import
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,8 +150,8 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '4.2'
|
153
|
-
description: '
|
154
|
-
https://developers.google.com/transit/gtfs'
|
153
|
+
description: 'A Rails Engine to provide a basic RESTful interface for GTFS feeds.
|
154
|
+
GTFS Spec: https://developers.google.com/transit/gtfs'
|
155
155
|
email: jon@ertt.ca
|
156
156
|
executables:
|
157
157
|
- rails
|
@@ -202,7 +202,6 @@ files:
|
|
202
202
|
- app/views/gtfs_engine/transfers/to.json.jsend
|
203
203
|
- app/views/gtfs_engine/trips/block.json.jsend
|
204
204
|
- bin/rails
|
205
|
-
- config/initializers/extensions_loader.rb
|
206
205
|
- config/routes.rb
|
207
206
|
- db/migrate/20140320045108_create_gtfs_engine_data_sets.rb
|
208
207
|
- db/migrate/20140320045232_create_gtfs_engine_calendars.rb
|
@@ -218,8 +217,6 @@ files:
|
|
218
217
|
- db/migrate/20140406071922_create_gtfs_engine_frequencies.rb
|
219
218
|
- db/migrate/20140406072309_create_gtfs_engine_transfers.rb
|
220
219
|
- db/migrate/20140406073548_create_gtfs_engine_feed_infos.rb
|
221
|
-
- lib/ext.rb
|
222
|
-
- lib/ext/active_record/associations/association.rb
|
223
220
|
- lib/gtfs_engine.rb
|
224
221
|
- lib/gtfs_engine/concerns.rb
|
225
222
|
- lib/gtfs_engine/concerns/controllers.rb
|
@@ -1,15 +0,0 @@
|
|
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/lib/ext.rb
DELETED
@@ -1,19 +0,0 @@
|
|
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
|
-
dir = File.dirname(__FILE__) + '/'
|
16
|
-
|
17
|
-
Dir[dir + 'ext/**/*.rb'].each do |extension|
|
18
|
-
require extension[dir.length..-1]
|
19
|
-
end
|
@@ -1,41 +0,0 @@
|
|
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
|
-
#
|
16
|
-
# Many GTFS associations reference arbitrary fields in the referenced table.
|
17
|
-
# This requires the use of the +primary_key:+ named parameter. Coincidentally,
|
18
|
-
# the name of the +foreign_key:+ is often the same as the referenced field. As
|
19
|
-
# a convenience, this file adds a +shared_key:+ named parameter which simply
|
20
|
-
# sets these two parameters to the same value.
|
21
|
-
module ActiveRecord
|
22
|
-
module Associations
|
23
|
-
class Association
|
24
|
-
def build_record_with_shared_key(attributes)
|
25
|
-
share_key attributes
|
26
|
-
build_record_without_shared_key attributes
|
27
|
-
end
|
28
|
-
alias_method_chain :build_record, :shared_key
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def share_key(attributes)
|
33
|
-
h = attributes.last
|
34
|
-
if Hash === h and h.key? :shared_key
|
35
|
-
key = h.delete :shared_key
|
36
|
-
h.reverse_merge! foreign_key: key, primary_key: key
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|