gtfs_engine 1.5.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +5 -5
  2. data/Rakefile +6 -5
  3. data/app/controllers/gtfs_engine/agencies_controller.rb +2 -14
  4. data/app/controllers/gtfs_engine/application_controller.rb +2 -14
  5. data/app/controllers/gtfs_engine/calendar_dates_controller.rb +2 -14
  6. data/app/controllers/gtfs_engine/calendars_controller.rb +7 -19
  7. data/app/controllers/gtfs_engine/data_sets_controller.rb +10 -24
  8. data/app/controllers/gtfs_engine/fare_attributes_controller.rb +2 -14
  9. data/app/controllers/gtfs_engine/fare_rules_controller.rb +2 -14
  10. data/app/controllers/gtfs_engine/feed_infos_controller.rb +2 -14
  11. data/app/controllers/gtfs_engine/frequencies_controller.rb +2 -14
  12. data/app/controllers/gtfs_engine/routes_controller.rb +2 -14
  13. data/app/controllers/gtfs_engine/shapes_controller.rb +2 -14
  14. data/app/controllers/gtfs_engine/stop_times_controller.rb +2 -14
  15. data/app/controllers/gtfs_engine/stops_controller.rb +2 -14
  16. data/app/controllers/gtfs_engine/transfers_controller.rb +9 -21
  17. data/app/controllers/gtfs_engine/trips_controller.rb +4 -16
  18. data/app/helpers/gtfs_engine/default_views_helper.rb +8 -21
  19. data/app/helpers/gtfs_engine/fields_helper.rb +3 -15
  20. data/app/models/gtfs_engine/agency.rb +3 -15
  21. data/app/models/gtfs_engine/calendar.rb +21 -38
  22. data/app/models/gtfs_engine/calendar_date.rb +5 -17
  23. data/app/models/gtfs_engine/data_set.rb +20 -32
  24. data/app/models/gtfs_engine/fare_attribute.rb +3 -15
  25. data/app/models/gtfs_engine/fare_rule.rb +9 -23
  26. data/app/models/gtfs_engine/feed_info.rb +3 -15
  27. data/app/models/gtfs_engine/frequency.rb +5 -17
  28. data/app/models/gtfs_engine/route.rb +4 -17
  29. data/app/models/gtfs_engine/shape.rb +5 -17
  30. data/app/models/gtfs_engine/stop.rb +5 -18
  31. data/app/models/gtfs_engine/stop_time.rb +5 -19
  32. data/app/models/gtfs_engine/transfer.rb +5 -17
  33. data/app/models/gtfs_engine/trip.rb +8 -25
  34. data/app/views/gtfs_engine/calendars/dates.json.jsend +3 -17
  35. data/app/views/gtfs_engine/data_sets/index.json.jsend +4 -18
  36. data/app/views/gtfs_engine/data_sets/show.json.jsend +2 -16
  37. data/app/views/gtfs_engine/gtfs/index.json.jsend +1 -15
  38. data/app/views/gtfs_engine/gtfs/show.json.jsend +1 -15
  39. data/app/views/gtfs_engine/transfers/from.json.jsend +1 -15
  40. data/app/views/gtfs_engine/transfers/from_to.json.jsend +1 -15
  41. data/app/views/gtfs_engine/transfers/to.json.jsend +1 -15
  42. data/app/views/gtfs_engine/trips/block.json.jsend +1 -15
  43. data/bin/rails +5 -3
  44. data/config/routes.rb +3 -16
  45. data/db/migrate/20140320045108_create_gtfs_engine_data_sets.rb +2 -0
  46. data/db/migrate/20140320045232_create_gtfs_engine_calendars.rb +2 -0
  47. data/db/migrate/20140320045751_create_gtfs_engine_calendar_dates.rb +2 -0
  48. data/db/migrate/20140320050100_create_gtfs_engine_shapes.rb +2 -0
  49. data/db/migrate/20140320051140_create_gtfs_engine_routes.rb +4 -2
  50. data/db/migrate/20140320052005_create_gtfs_engine_stops.rb +4 -2
  51. data/db/migrate/20140320052508_create_gtfs_engine_trips.rb +3 -1
  52. data/db/migrate/20140320052907_create_gtfs_engine_stop_times.rb +2 -0
  53. data/db/migrate/20140401032609_create_gtfs_engine_agencies.rb +2 -0
  54. data/db/migrate/20140405235947_create_gtfs_engine_fare_attributes.rb +2 -0
  55. data/db/migrate/20140406063500_create_gtfs_engine_fare_rules.rb +3 -1
  56. data/db/migrate/20140406071922_create_gtfs_engine_frequencies.rb +2 -0
  57. data/db/migrate/20140406072309_create_gtfs_engine_transfers.rb +2 -0
  58. data/db/migrate/20140406073548_create_gtfs_engine_feed_infos.rb +2 -0
  59. data/lib/gtfs_engine.rb +2 -14
  60. data/lib/gtfs_engine/concerns.rb +2 -14
  61. data/lib/gtfs_engine/concerns/controllers.rb +10 -18
  62. data/lib/gtfs_engine/concerns/controllers/data_access.rb +28 -40
  63. data/lib/gtfs_engine/concerns/controllers/gtfs.rb +17 -50
  64. data/lib/gtfs_engine/engine.rb +2 -15
  65. data/lib/gtfs_engine/exceptions.rb +4 -19
  66. data/lib/gtfs_engine/json_responder.rb +9 -23
  67. data/lib/gtfs_engine/middleware/base.rb +6 -19
  68. data/lib/gtfs_engine/middleware/json_parse_errors.rb +6 -20
  69. data/lib/gtfs_engine/sources.rb +33 -44
  70. data/lib/gtfs_engine/version.rb +30 -37
  71. data/lib/tasks/gtfs_engine_tasks.rake +15 -25
  72. metadata +36 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 78ec8eda402765bdfe6c1b0229be9b216277e81f
4
- data.tar.gz: ca6ee20bbf4fd958f6b378b616687d29618ab33b
2
+ SHA256:
3
+ metadata.gz: 02cb0a7ffc669fa4275fb0c6a35ad9473e120ce7ce2145a4a4a14ebc3393b273
4
+ data.tar.gz: 4cd67072f4747c6bd758f5857d4dc65c9b1bf7dbc029a52e89a1d5114429b0b5
5
5
  SHA512:
6
- metadata.gz: 78fccb3e66380b25bbd0ddd3c70502277e587a65b7934658baaec59392295912e4573a1fd59cb97c0cf39349311a21b3d882538a7d947d6ba65d953e53c4d91f
7
- data.tar.gz: fe8bd3064d742d70025a3eb3317e66a7549b1d3fd5da81c900cf2dd0738473d8644c996f5b040eb00758f97d2987f290b3636a76ea1344630a9e07cf84b495eb
6
+ metadata.gz: 91649e7f8fa25159ae6866bcbe8d1bbefc19841a070af12e5072daa58f4adc871cbf0ce37d9bf9706c7190f1b16294137227b9b212b28f5796187cc5f44f8795
7
+ data.tar.gz: f242bfc52c4cc6e96346abd85058ca16f46e29ad6ed2a306e598c861ff6f0b8cbe259e3590791fbc0380dcb67b255883fbf1f15236c8489f270d36b682915760
data/Rakefile CHANGED
@@ -1,20 +1,21 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  begin
3
4
  require 'bundler/setup'
4
5
  rescue LoadError
5
6
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
7
  end
7
8
 
8
- require 'jeweler'
9
+ require 'juwelier'
9
10
  require File.dirname(__FILE__) + '/lib/gtfs_engine/version'
10
11
 
11
- Jeweler::Tasks.new do |gem|
12
+ Juwelier::Tasks.new do |gem|
12
13
  gem.name = 'gtfs_engine'
13
14
  gem.version = GtfsEngine::Version.to_s
14
15
  gem.homepage = 'http://github.com/sangster/gtfs_engine'
15
16
  gem.license = 'GPL-3.0'
16
17
  gem.summary = 'Read General Transit Feed Specification zip files'
17
- gem.description = <<-EOF.strip.gsub /\s+/, ' '
18
+ gem.description = <<-EOF.strip.gsub(/\s+/, ' ')
18
19
  A Rails Engine to provide a basic RESTful interface for GTFS feeds.
19
20
 
20
21
  GTFS Spec: https://developers.google.com/transit/gtfs
@@ -25,7 +26,7 @@ Jeweler::Tasks.new do |gem|
25
26
  gem.files = Dir['{app,config,db,lib}/**/*', 'Rakefile']
26
27
  end
27
28
 
28
- Jeweler::RubygemsDotOrgTasks.new
29
+ Juwelier::RubygemsDotOrgTasks.new
29
30
 
30
31
  task bump: ['bump:patch']
31
32
  namespace :bump do
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class AgenciesController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class ApplicationController < ActionController::Base
17
5
  include Concerns::Controllers::DataAccess
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class CalendarDatesController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class CalendarsController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -30,20 +18,20 @@ module GtfsEngine
30
18
 
31
19
  def for_date
32
20
  date = params[:YYYY_MM_DD]
33
- check_format! date
34
- @records = Calendar.from_date_string date
35
- respond_with @records, template: 'gtfs_engine/gtfs/index'
21
+ check_format!(date)
22
+ @records = Calendar.from_date_string(date)
23
+ respond_with(@records, template: 'gtfs_engine/gtfs/index')
36
24
  end
37
25
 
38
26
  def dates
39
27
  @dates = record.dates
40
- render :dates
28
+ render(:dates)
41
29
  end
42
30
 
43
31
  private
44
32
 
45
33
  def check_format!(date_str)
46
- unless %r{^\d{4}-\d\d-\d\d$} === date_str
34
+ unless /^\d{4}-\d\d-\d\d$/ === date_str
47
35
  raise DateFormatError, "Got '#{date_str}. Expected format: YYYY-MM-DD'"
48
36
  end
49
37
  end
@@ -1,21 +1,9 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class DataSetsController < ApplicationController
17
5
  def index
18
- expires_in 3.hours
6
+ expires_in(3.hours)
19
7
 
20
8
  @data_sets = Rails.cache.fetch('data_sets_index') do
21
9
  {}.tap do |sets|
@@ -25,22 +13,20 @@ module GtfsEngine
25
13
  end
26
14
  end
27
15
 
28
- dates = @data_sets.values.flatten.collect &:created_at
29
- if stale? last_modified: dates.max, public: true
30
- respond_with @data_sets
31
- end
16
+ dates = @data_sets.values.flatten.collect(&:created_at)
17
+ respond_with(@data_sets) if stale?(last_modified: dates.max, public: true)
32
18
  end
33
19
 
34
20
  def show
35
- expires_in 2.hours
21
+ expires_in(2.hours)
36
22
 
37
- @data_set = data :id
23
+ @data_set = data(:id)
38
24
 
39
25
  # Set location if the given id is a data-source name and not an ID
40
- if param_is_data_set_name? :id
41
- respond_with @data_set, location: data_set_url(@data_set)
26
+ if param_is_data_set_name?(:id)
27
+ respond_with(@data_set, location: data_set_url(@data_set))
42
28
  else
43
- respond_with @data_set
29
+ respond_with(@data_set)
44
30
  end
45
31
  end
46
32
  end
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class FareAttributesController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class FareRulesController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class FeedInfosController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class FrequenciesController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class RoutesController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class ShapesController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class StopTimesController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class StopsController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class TransfersController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -20,19 +8,19 @@ module GtfsEngine
20
8
  :min_transfer_time
21
9
 
22
10
  def from
23
- @transfers = collection.where from_stop_id: params[:stop_id]
24
- respond_with @transfers
11
+ @transfers = collection.where(from_stop_id: params[:stop_id])
12
+ respond_with(@transfers)
25
13
  end
26
14
 
27
15
  def to
28
- @transfers = collection.where to_stop_id: params[:stop_id]
29
- respond_with @transfers
16
+ @transfers = collection.where(to_stop_id: params[:stop_id])
17
+ respond_with(@transfers)
30
18
  end
31
19
 
32
20
  def from_to
33
- @transfer = collection.find_by from_stop_id: params[:from_id],
34
- to_stop_id: params[:to_id]
35
- respond_with @transfer
21
+ @transfer = collection.find_by(from_stop_id: params[:from_id],
22
+ to_stop_id: params[:to_id])
23
+ respond_with(@transfer)
36
24
  end
37
25
  end
38
26
  end
@@ -1,17 +1,5 @@
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/>.
1
+ # frozen_string_literal: true
2
+
15
3
  module GtfsEngine
16
4
  class TripsController < ApplicationController
17
5
  include Concerns::Controllers::Gtfs
@@ -27,8 +15,8 @@ module GtfsEngine
27
15
  :bikes_allowed
28
16
 
29
17
  def block
30
- @trips = collection.where block_id: params[:id]
31
- respond_with @trips
18
+ @trips = collection.where(block_id: params[:id])
19
+ respond_with(@trips)
32
20
  end
33
21
  end
34
22
  end