aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/api
diff options
context:
space:
mode:
authorMarc Florisson2012-12-05 18:32:07 +0100
committerMarc Florisson2012-12-05 18:32:07 +0100
commitfdd87a8e14d3fcbf0f2fd91d6f2280e0128c73cf (patch)
tree2dfc14269959e49f352fd84233ea88d635926ed8 /app/controllers/api
parent2570573d472010249b753e404c6cad003a78ad39 (diff)
downloadchouette-core-fdd87a8e14d3fcbf0f2fd91d6f2280e0128c73cf.tar.bz2
add more controllers in api/V1
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/companies_controller.rb13
-rw-r--r--app/controllers/api/v1/connection_links_controller.rb13
-rw-r--r--app/controllers/api/v1/time_tables_controller.rb13
-rw-r--r--app/controllers/api/v1/vehicle_journeys_controller.rb17
4 files changed, 56 insertions, 0 deletions
diff --git a/app/controllers/api/v1/companies_controller.rb b/app/controllers/api/v1/companies_controller.rb
new file mode 100644
index 000000000..3f2cd2e7b
--- /dev/null
+++ b/app/controllers/api/v1/companies_controller.rb
@@ -0,0 +1,13 @@
+class Api::V1::CompaniesController < Api::V1::ChouetteController
+ inherit_resources
+
+ defaults :resource_class => Chouette::Company, :finder => :find_by_objectid!
+
+protected
+
+ def collection
+ @companies ||= referential.companies
+ end
+
+end
+
diff --git a/app/controllers/api/v1/connection_links_controller.rb b/app/controllers/api/v1/connection_links_controller.rb
new file mode 100644
index 000000000..7aa072cf3
--- /dev/null
+++ b/app/controllers/api/v1/connection_links_controller.rb
@@ -0,0 +1,13 @@
+class Api::V1::ConnectionLinksController < Api::V1::ChouetteController
+ inherit_resources
+
+ defaults :resource_class => Chouette::ConnectionLink, :finder => :find_by_objectid!
+
+protected
+
+ def collection
+ @connection_links ||= referential.connection_links
+ end
+
+end
+
diff --git a/app/controllers/api/v1/time_tables_controller.rb b/app/controllers/api/v1/time_tables_controller.rb
new file mode 100644
index 000000000..53f564a52
--- /dev/null
+++ b/app/controllers/api/v1/time_tables_controller.rb
@@ -0,0 +1,13 @@
+class Api::V1::TimeTablesController < Api::V1::ChouetteController
+ inherit_resources
+
+ defaults :resource_class => Chouette::TimeTable, :finder => :find_by_objectid!
+
+protected
+
+ def collection
+ @time_tables ||= referential.time_tables
+ end
+
+end
+
diff --git a/app/controllers/api/v1/vehicle_journeys_controller.rb b/app/controllers/api/v1/vehicle_journeys_controller.rb
new file mode 100644
index 000000000..2dd78cc19
--- /dev/null
+++ b/app/controllers/api/v1/vehicle_journeys_controller.rb
@@ -0,0 +1,17 @@
+class Api::V1::VehicleJourneysController < Api::V1::ChouetteController
+ inherit_resources
+
+ defaults :resource_class => Chouette::VehicleJourney, :finder => :find_by_objectid!
+
+ belongs_to :line, :parent_class => Chouette::Line, :optional => true, :finder => :find_by_objectid!, :param => :line_id do
+ belongs_to :route, :parent_class => Chouette::Route, :optional => true, :finder => :find_by_objectid!, :param => :route_id
+ end
+
+protected
+
+ def collection
+ @vehicle_journeys ||= parent.vehicle_journeys
+ end
+
+end
+