diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-07-04 11:27:43 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-07-04 11:27:43 +0100 |
commit | b3f46a4232e244e19c9dc1345c37322ea4a091da (patch) | |
tree | d14e4e5ec882f81d7bd833d5e51ee2794f35a154 /app/controllers/api_controller.rb | |
parent | 5c2eb90495ff5ccd38ac1a0cddc3c2408c69bcf9 (diff) |
WIP new requests feed
Diffstat (limited to 'app/controllers/api_controller.rb')
-rw-r--r-- | app/controllers/api_controller.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 524aa44b7..b34386377 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -155,6 +155,20 @@ class ApiController < ApplicationController head :no_content end + def body_new_requests + feed_type = params[:feed_type] + raise PermissionDenied.new("#{@public_body.id} != #{params[:id]}") if @public_body.id != params[:id].to_i + + @requests = @public_body.info_requests + if feed_type == "atom" + render :template => "api/new_requests.atom" + elsif feed_type == "json" + render :json => @requests + else + raise ActiveRecord::RecordNotFound.new("Unrecognised feed type: " + feed_type) + end + end + protected def check_api_key raise "Missing required parameter 'k'" if params[:k].nil? |