aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/api_controller.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-07-04 11:27:43 +0100
committerRobin Houston <robin.houston@gmail.com>2012-07-04 11:27:43 +0100
commitb3f46a4232e244e19c9dc1345c37322ea4a091da (patch)
treed14e4e5ec882f81d7bd833d5e51ee2794f35a154 /app/controllers/api_controller.rb
parent5c2eb90495ff5ccd38ac1a0cddc3c2408c69bcf9 (diff)
WIP new requests feed
Diffstat (limited to 'app/controllers/api_controller.rb')
-rw-r--r--app/controllers/api_controller.rb14
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?