diff options
| author | Marc Florisson | 2012-12-06 16:19:12 +0100 |
|---|---|---|
| committer | Marc Florisson | 2012-12-06 16:19:12 +0100 |
| commit | c57e39e2b2ef4152e35c1b886aaffc6536121fab (patch) | |
| tree | cb5643fc3082a111db24989dfe9b80e291950fba /app/controllers/api | |
| parent | fdd87a8e14d3fcbf0f2fd91d6f2280e0128c73cf (diff) | |
| download | chouette-core-c57e39e2b2ef4152e35c1b886aaffc6536121fab.tar.bz2 | |
define json and xml views for api/v1
Diffstat (limited to 'app/controllers/api')
| -rw-r--r-- | app/controllers/api/v1/networks_controller.rb | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/app/controllers/api/v1/networks_controller.rb b/app/controllers/api/v1/networks_controller.rb index c3d52348b..7443445df 100644 --- a/app/controllers/api/v1/networks_controller.rb +++ b/app/controllers/api/v1/networks_controller.rb @@ -1,25 +1,15 @@ module Api module V1 - class NetworksController < ChouetteController - def networks + class NetworksController < ChouetteController + inherit_resources + + defaults :resource_class => Chouette::Network, :finder => :find_by_objectid! + + protected + + def collection @networks ||= referential.networks end - def network - @network ||= networks.where( :objectid => params[:id]) - end - - def index - respond_to do |format| - format.json { render :json => networks } - format.xml { render :xml => networks } - end - end - def show - respond_to do |format| - format.json { render :json => network } - format.xml { render :xml => network } - end - end end end end |
