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/Service/Attribute.pm | |
parent | c1178ea85d1879d6533ac09e2a3c813441554b43 (diff) | |
parent | a09c61c807d8d6b50227c9d8aa687f1eb22bad00 (diff) |
Merge branch 'stevenage-open311'
Diffstat (limited to 'perllib/Open311/Endpoint/Service/Attribute.pm')
-rw-r--r-- | perllib/Open311/Endpoint/Service/Attribute.pm | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/perllib/Open311/Endpoint/Service/Attribute.pm b/perllib/Open311/Endpoint/Service/Attribute.pm deleted file mode 100644 index f88919408..000000000 --- a/perllib/Open311/Endpoint/Service/Attribute.pm +++ /dev/null @@ -1,82 +0,0 @@ -package Open311::Endpoint::Service::Attribute; -use Moo; -use MooX::HandlesVia; -use Types::Standard ':all'; -use namespace::clean; - -# from http://wiki.open311.org/GeoReport_v2#GET_Service_Definition - -# A unique identifier for the attribute -has code => ( - is => 'ro', - isa => Str, -); - -# true denotes that user input is needed -# false means the attribute is only used to present information to the user within the description field -# -# NB: unsure what false means for the rest of the options here, e.g. should remainder of fields by Maybe[] ? -has variable => ( - is => 'ro', - isa => Bool, - default => sub { 1 }, -); - -# Denotes the type of field used for user input. -has datatype => ( - is => 'ro', - isa => Enum[qw/ string number datetime text singlevaluelist multivaluelist /], -); - -has required => ( - is => 'ro', - isa => Bool, -); - -# A description of the datatype which helps the user provide their input -has datatype_description => ( - is => 'ro', - isa => Str, -); - -# A description of the attribute field with instructions for the user to find -# and identify the requested information -has description => ( - is => 'ro', - isa => Str, -); - -# NB: we don't model the "Order" field here, as that's really for the Service -# object to return - -# only relevant for singlevaluelist or multivaluelist -has values => ( - is => 'ro', - isa => HashRef, - default => sub { {} }, - handles_via => 'Hash', - handles => { - get_value => 'get', - get_values => 'keys', - has_values => 'count', - values_kv => 'kv', - } -); - -sub schema_definition { - my $self = shift; - - my @values = map +{ type => '//str', value => $_ }, $self->get_values; - my %schema_types = ( - string => '//str', - number => '//num', - datetime => '//str', # TODO - text => '//str', - singlevaluelist => { type => '//any', of => [@values] }, - multivaluelist => { type => '//arr', of => [@values] }, - ); - - return $schema_types{ $self->datatype }; -} - -1; |