Skip to content

Commit fefed49

Browse files
committed
[Echo] Allow multiple reservation slots.
1 parent fd7df6c commit fefed49

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

perllib/Integrations/Echo.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ sub PostEvent {
177177
EventObjects => { EventObject => $source },
178178
EventTypeId => $args->{event_type},
179179
ServiceId => $args->{service},
180-
$args->{reservation} ? (TaskReservations => [ { 'msArray:string' => $args->{reservation} } ]) : (),
180+
$args->{reservation} ? (TaskReservations => [ map { { 'msArray:string' => $_ } } @{$args->{reservation}} ]) : (),
181181
);
182182
$self->call('PostEvent', event => $data);
183183
}

perllib/Open311/Endpoint/Integration/Echo.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ sub process_service_request_args {
463463
$request->{guid} = $guid;
464464
}
465465
if (my $reservation = $args->{attributes}{reservation}) {
466-
$request->{reservation} = $reservation;
466+
$request->{reservation} = [ split /::/, $reservation ];
467467
}
468468

469469
return $request;

t/open311/endpoint/sutton.t

+6-4
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ $soap_lite->mock(call => sub {
6666
is $event_type, 3145;
6767
is $service_id, 944;
6868
is $guid, 'd5f79551-3dc4-11ee-ab68-f0c87781f93b';
69-
my $reservation = ${$params[5+$offset]->value}->value->value;
70-
is $reservation->name, 'string';
71-
is $reservation->value, 'reservation==';
69+
my @reservations = ${$params[5+$offset]->value}->value->value;
70+
is $reservations[0]->name, 'string';
71+
is $reservations[0]->value, 'reservation1==';
72+
is $reservations[1]->name, 'string';
73+
is $reservations[1]->value, 'reservation2==';
7274
my @data = ${$params[$offset]->value}->value->value;
7375
is scalar @data, 0;
7476
} elsif ($client_ref eq 'LBS-2000123') {
@@ -147,7 +149,7 @@ subtest "POST missed mixed+paper OK" => sub {
147149
'attribute[fixmystreet_id]' => 2000125,
148150
'attribute[service_id]' => 944,
149151
'attribute[GUID]' => 'd5f79551-3dc4-11ee-ab68-f0c87781f93b',
150-
'attribute[reservation]' => 'reservation==',
152+
'attribute[reservation]' => 'reservation1==::reservation2==',
151153
);
152154
ok $res->is_success, 'valid request'
153155
or diag $res->content;

0 commit comments

Comments
 (0)