aboutsummaryrefslogtreecommitdiffstats
path: root/bin/fetch-reports-24hs
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2018-06-07 13:28:45 +0200
committerMarius Halden <marius.h@lden.org>2018-06-07 13:28:45 +0200
commit956f8b8a065824f9a9dc379eba1d0aa8b1b669cf (patch)
tree49f9ccb147b18dddee97500d4df7a3fb3dd3737c /bin/fetch-reports-24hs
parent782457d016084c8de04989dbc824a71899f8b41b (diff)
parent4dbf5371f79c5f290c08e561ba2c881e96b58669 (diff)
Merge tag 'v2.3.3' into fiksgatami-dev
Diffstat (limited to 'bin/fetch-reports-24hs')
-rwxr-xr-xbin/fetch-reports-24hs35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/fetch-reports-24hs b/bin/fetch-reports-24hs
new file mode 100755
index 000000000..ec0eabc2e
--- /dev/null
+++ b/bin/fetch-reports-24hs
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+#
+# This script utilises Open311 as described at
+# http://wiki.open311.org/GeoReport_v2/#get-service-requests
+# to fetch service requests.
+
+use strict;
+use warnings;
+require 5.8.0;
+
+BEGIN {
+ use File::Basename qw(dirname);
+ use File::Spec;
+ my $d = dirname(File::Spec->rel2abs($0));
+ require "$d/../setenv.pl";
+}
+
+use DateTime;
+
+use CronFns;
+my ($verbose, $nomail) = CronFns::options();
+
+use Open311::GetServiceRequests;
+
+my $dt = DateTime->now();
+my $dt_24hrs_ago = $dt->clone;
+$dt_24hrs_ago->add( hours => -24 );
+
+my $reports = Open311::GetServiceRequests->new(
+ verbose => 1,
+ start_date => $dt_24hrs_ago,
+ end_date => $dt
+);
+
+$reports->fetch;