diff options
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? |