diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-08-26 15:05:30 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-08-26 15:05:30 +0100 |
commit | 0e45fa27e4bc857f61b71f6c121a61e08e54cb6a (patch) | |
tree | 7e83c50825819b60a9a73f16c4d4f0a4ff247650 /perllib/Open311/Endpoint/Result.pm | |
parent | c1178ea85d1879d6533ac09e2a3c813441554b43 (diff) | |
parent | a09c61c807d8d6b50227c9d8aa687f1eb22bad00 (diff) |
Merge branch 'stevenage-open311'
Diffstat (limited to 'perllib/Open311/Endpoint/Result.pm')
-rw-r--r-- | perllib/Open311/Endpoint/Result.pm | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/perllib/Open311/Endpoint/Result.pm b/perllib/Open311/Endpoint/Result.pm deleted file mode 100644 index 61454e749..000000000 --- a/perllib/Open311/Endpoint/Result.pm +++ /dev/null @@ -1,38 +0,0 @@ -package Open311::Endpoint::Result; -use Moo; - -has status => ( - is => 'ro', -); -has data => ( - is => 'ro', -); - -sub success { - my ($class, $data) = @_; - return $class->new({ - status => 200, - data => $data, - }); -} - -sub error { - my ($class, $code, @errors) = @_; - $code ||= 400; - return $class->new({ - status => $code, - data => { - errors => [ - map { - ref $_ eq 'HASH' ? $_ : - { - code => $code, - description => "$_", - } - } @errors, - ], - }, - }); -} - -1; |