Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rutland] Adds Easting/Northing through Open311 #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions perllib/Integrations/SalesForce/Rutland.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ sub post_request {
Service_Area__c => $args->{service_code},
title__c => $args->{attributes}->{title},
service_request_id__c => $args->{attributes}->{external_id} + 0,
easting__c => $args->{attributes}->{easting},
northing__c => $args->{attributes}->{northing},
};

# add category specific attributes
Expand Down
18 changes: 18 additions & 0 deletions perllib/Open311/Endpoint/Service/UKCouncil/Rutland.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ has '+attributes' => (
automated => 'server_set',
description => 'closest_address',
),
Open311::Endpoint::Service::Attribute->new(
code => 'easting',
variable => 0, # set by server
datatype => 'number',
required => 1,
automated => 'server_set',
description => 'easting',
),
Open311::Endpoint::Service::Attribute->new(
code => 'northing',
variable => 0, # set by server
datatype => 'number',
required => 1,
automated => 'server_set',
description => 'northing',
),
] },
);

Expand All @@ -50,6 +66,8 @@ has internal_attributes => (
closest_address => 1,
group_hint => 1,
hint => 1,
easting => 1,
northing => 1,
} },
);

Expand Down
61 changes: 55 additions & 6 deletions t/open311/endpoint/rutland.t
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ my %responses = (
"interface_used__c": "Web interface",
"lat__c": 52.669102,
"long__c": -0.723561,
"easting__c": 1234,
"northing__c": 4567,
"requestor_name__c": "A User",
"service_request_id__c": 12345,
"title__c": "Car",
Expand Down Expand Up @@ -106,6 +108,8 @@ my %responses = (
"interface_used__c": "Web interface",
"lat__c": 52.68248,
"long__c": -0.469137,
"easting__c": 1234,
"northing__c": 4567,
"requestor_name__c": "Struan Donald",
"requested_datetime__c": "2018-01-09T18:00:00.000+0000",
"service_request_id__c": 975,
Expand Down Expand Up @@ -246,6 +250,8 @@ subtest "create basic problem" => sub {
description => 'description',
lat => '50',
long => '0.1',
'attribute[easting]' => '1234',
'attribute[northing]' => '4567',
'attribute[description]' => 'description',
'attribute[external_id]' => '1',
'attribute[title]' => '1',
Expand All @@ -255,7 +261,6 @@ subtest "create basic problem" => sub {
ok $res->is_success, 'valid request'
or diag $res->content;


is_deeply decode_json($sent),
[{
"detail__c" => "description",
Expand All @@ -273,7 +278,9 @@ subtest "create basic problem" => sub {
"contact_name__c" => "Bob Mould",
"contact_email__c" => '[email protected]',
"agency_sent_datetime__c" => "2014-01-01T12:00:00+0000",
"agency_responsible__c" => "Rutland County Council"
"agency_responsible__c" => "Rutland County Council",
"easting__c" => '1234',
"northing__c" => '4567',
}] , 'correct json sent';

is_deeply decode_json($res->content),
Expand All @@ -297,6 +304,8 @@ subtest "create problem with extra categories" => sub {
description => 'description',
lat => '50',
long => '0.1',
'attribute[easting]' => '1234',
'attribute[northing]' => '4567',
'attribute[description]' => 'description',
'attribute[external_id]' => '1',
'attribute[title]' => '1',
Expand Down Expand Up @@ -326,6 +335,8 @@ subtest "create problem with extra categories" => sub {
contact_email__c => '[email protected]',
agency_sent_datetime__c => "2014-01-01T12:00:00+0000",
agency_responsible__c => "Rutland County Council",
easting__c => '1234',
northing__c => '4567',
extra => "extra_attribute"
}] , 'correct json sent';

Expand All @@ -350,6 +361,8 @@ subtest "create problem with extra list categories" => sub {
description => 'description',
lat => '50',
long => '0.1',
'attribute[easting]' => '1234',
'attribute[northing]' => '4567',
'attribute[pot_type]' => 'Don´t know',
'attribute[external_id]' => '1',
'attribute[title]' => '1',
Expand Down Expand Up @@ -379,6 +392,8 @@ subtest "create problem with extra list categories" => sub {
contact_email__c => '[email protected]',
agency_sent_datetime__c => "2014-01-01T12:00:00+0000",
agency_responsible__c => "Rutland County Council",
easting__c => '1234',
northing__c => '4567',
pot_type => "Don´t know"
}] , 'correct json sent';

Expand All @@ -403,6 +418,8 @@ subtest "create problem with multiple photos" => sub {
description => 'description',
lat => '50',
long => '0.1',
'attribute[easting]' => '1234',
'attribute[northing]' => '4567',
'attribute[description]' => 'description',
'attribute[external_id]' => '1',
'attribute[title]' => '1',
Expand Down Expand Up @@ -433,7 +450,9 @@ subtest "create problem with multiple photos" => sub {
contact_name__c => "Bob Mould",
contact_email__c => '[email protected]',
agency_sent_datetime__c => "2014-01-01T12:00:00+0000",
agency_responsible__c => "Rutland County Council"
agency_responsible__c => "Rutland County Council",
easting__c => '1234',
northing__c => '4567',
}] , 'correct json sent for mulitple photos';

is_deeply decode_json($res->content),
Expand All @@ -457,6 +476,8 @@ subtest "create problem with unrecognised attribute" => sub {
description => 'description',
lat => '50',
long => '0.1',
'attribute[easting]' => '1234',
'attribute[northing]' => '4567',
'attribute[description]' => 'description',
'attribute[external_id]' => '1',
'attribute[title]' => '1',
Expand All @@ -483,6 +504,8 @@ subtest "create problem with unrecognised attribute" => sub {
contact_email__c => '[email protected]',
agency_sent_datetime__c => "2014-01-01T12:00:00+0000",
agency_responsible__c => "Rutland County Council",
easting__c => '1234',
northing__c => '4567',
}] , 'correct json sent';
};

Expand Down Expand Up @@ -539,6 +562,8 @@ subtest "check fetch problem with not responsible status" => sub {
"interface_used__c": "Web interface",
"lat__c": 52.68248,
"long__c": -0.469137,
"easting__c": 1234,
"northing__c": 4567,
"requestor_name__c": "Struan Donald",
"requested_datetime__c": "2018-01-09T18:00:00.000+0000",
"service_request_id__c": 975,
Expand Down Expand Up @@ -604,6 +629,8 @@ subtest "check fetch problem ignores problems older than start date" => sub {
"interface_used__c": "Web interface",
"lat__c": 52.68248,
"long__c": -0.469137,
"easting__c": 1234,
"northing__c": 4567,
"requestor_name__c": "Struan Donald",
"requested_datetime__c": "2018-01-09T18:00:00.000+0000",
"service_request_id__c": 975,
Expand Down Expand Up @@ -654,6 +681,8 @@ subtest "check fetch problem works with no start date" => sub {
"interface_used__c": "Web interface",
"lat__c": 52.68248,
"long__c": -0.469137,
"easting__c": 1234,
"northing__c": 4567,
"requestor_name__c": "Struan Donald",
"requested_datetime__c": "2018-01-09T18:00:00.000+0000",
"service_request_id__c": 975,
Expand Down Expand Up @@ -968,13 +997,33 @@ subtest "check fetch service metadata" => sub {
description => "closest_address",
automated => 'server_set',
},
{
required => "true",
description => "easting",
code => "easting",
automated => "server_set",
variable => "false",
order => 5,
datatype => "number",
datatype_description => ""
},
{
required => "true",
description => "northing",
code => "northing",
automated => "server_set",
variable => "false",
order => 6,
datatype => "number",
datatype_description => ""
},
{
variable => 'true',
code => "extra",
datatype => "string",
required => 'false',
datatype_description => '',
order => 5,
order => 7,
description => "Additional Information",
},
{
Expand All @@ -983,7 +1032,7 @@ subtest "check fetch service metadata" => sub {
datatype => "string",
required => 'false',
datatype_description => '',
order => 6,
order => 8,
description => "<span>This is the category HTML hint</span>",
automated => 'server_set',
},
Expand All @@ -993,7 +1042,7 @@ subtest "check fetch service metadata" => sub {
datatype => "string",
required => 'false',
datatype_description => '',
order => 7,
order => 9,
description => "<span>This is the group HTML hint</span>",
automated => 'server_set',
}
Expand Down
Loading