aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/api
diff options
context:
space:
mode:
authorlwang2013-02-26 16:54:41 +0100
committerlwang2013-02-26 16:54:41 +0100
commite8cc20898cce3b4249411eb188fefc211db79c63 (patch)
treee7e8d2f250dfa59ecbd7449b3cdf5d67ade84a22 /app/controllers/api
parentced4e122d9204e0e507f0a34c53f978c4d73c45d (diff)
downloadchouette-core-e8cc20898cce3b4249411eb188fefc211db79c63.tar.bz2
complete api v1 for group lines, access points and access links
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/access_links_controller.rb14
-rw-r--r--app/controllers/api/v1/access_points_controller.rb13
-rw-r--r--app/controllers/api/v1/group_of_lines_controller.rb12
3 files changed, 39 insertions, 0 deletions
diff --git a/app/controllers/api/v1/access_links_controller.rb b/app/controllers/api/v1/access_links_controller.rb
new file mode 100644
index 000000000..1b9c98538
--- /dev/null
+++ b/app/controllers/api/v1/access_links_controller.rb
@@ -0,0 +1,14 @@
+class Api::V1::AccessLinksController < Api::V1::ChouetteController
+
+ defaults :resource_class => Chouette::AccessLink, :finder => :find_by_objectid!
+
+protected
+
+ def collection
+ @access_links ||= ( @referential ? @referential.access_links.search(params[:q]).result(:distinct => true) : [])
+
+ end
+
+end
+
+
diff --git a/app/controllers/api/v1/access_points_controller.rb b/app/controllers/api/v1/access_points_controller.rb
new file mode 100644
index 000000000..4c3f5adc0
--- /dev/null
+++ b/app/controllers/api/v1/access_points_controller.rb
@@ -0,0 +1,13 @@
+class Api::V1::AccessPointsController < Api::V1::ChouetteController
+
+ defaults :resource_class => Chouette::AccessPoint, :finder => :find_by_objectid!
+
+protected
+
+ def collection
+ @access_points ||= ( @referential ? @referential.access_points.search(params[:q]).result(:distinct => true) : [])
+
+ end
+
+end
+
diff --git a/app/controllers/api/v1/group_of_lines_controller.rb b/app/controllers/api/v1/group_of_lines_controller.rb
new file mode 100644
index 000000000..b3760e1b0
--- /dev/null
+++ b/app/controllers/api/v1/group_of_lines_controller.rb
@@ -0,0 +1,12 @@
+class Api::V1::GroupOfLinesController < Api::V1::ChouetteController
+
+ defaults :resource_class => Chouette::GroupOfLine, :finder => :find_by_objectid!
+
+protected
+
+ def collection
+ @group_of_lines ||= ( @referential ? @referential.group_of_lines.search(params[:q]).result(:distinct => true) : [])
+
+ end
+
+end \ No newline at end of file