aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/JSON.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-03 14:28:46 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-03 14:28:46 +0100
commitb8e2d75cc1c74584dfdf8571c241dab7182c4543 (patch)
tree3fdfa0d55b8c33d75b1f63ac7b80112f07941254 /perllib/FixMyStreet/App/Controller/JSON.pm
parenta90bb442e432e97b0714cf3ce645b0c5c50765fe (diff)
parent7b405637a1ac3436cf90acc7d5ad46f1b80c8250 (diff)
Merge branch 'migrate_to_catalyst' of ssh://git.mysociety.org/data/git/public/fixmystreet into migrate_to_catalyst
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/JSON.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/JSON.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm
index c437aafc0..d3688f19a 100644
--- a/perllib/FixMyStreet/App/Controller/JSON.pm
+++ b/perllib/FixMyStreet/App/Controller/JSON.pm
@@ -18,15 +18,24 @@ Provide information as JSON
=head1 METHODS
-=head2 json
+=head2 problems
+
+Provide JSON of new/fixed problems in a specified time range
=cut
-sub json : Path : Args(0) {
- my ( $self, $c ) = @_;
+sub problems : Local {
+ my ( $self, $c, $path_type ) = @_;
+
+ # get the type from the path - this is to deal with the historic url
+ # structure. In futur
+ $path_type ||= '';
+ my $type =
+ $path_type eq 'new' ? 'new_problems'
+ : $path_type eq 'fixed' ? 'fixed_problems'
+ : '';
# gather the parameters
- my $type = $c->req->param('type') || '';
my $start_date = $c->req->param('start_date') || '';
my $end_date = $c->req->param('end_date') || '';