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

[Echo] Add address_types to the Echo integration class #5318

Merged
merged 1 commit into from
Jan 7, 2025
Merged
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: 1 addition & 1 deletion perllib/FixMyStreet/Roles/Cobrand/Echo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

my $cfg = $self->feature('echo');
my $echo = Integrations::Echo->new(%$cfg);
my $points = $echo->FindPoints($pc, $cfg);
my $points = $echo->FindPoints($pc);

Check warning on line 96 in perllib/FixMyStreet/Roles/Cobrand/Echo.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Roles/Cobrand/Echo.pm#L96

Added line #L96 was not covered by tests
my $data = [ map { {
value => $_->{Id},
label => FixMyStreet::Template::title($_->{Description}),
Expand Down
8 changes: 4 additions & 4 deletions perllib/Integrations/Echo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
has username => ( is => 'ro' );
has password => ( is => 'ro' );
has url => ( is => 'ro' );
has address_types => ( is => 'ro' );

has sample_data => ( is => 'ro', default => 0 );

Expand Down Expand Up @@ -183,15 +184,14 @@
sub FindPoints {
my $self = shift;
my $pc = shift;
my $cfg = shift;

my $obj = ixhash(
PointType => 'PointAddress',
Postcode => $pc,
);
if ($cfg->{address_types}) {
if ($self->address_types) {

Check warning on line 192 in perllib/Integrations/Echo.pm

View check run for this annotation

Codecov / codecov/patch

perllib/Integrations/Echo.pm#L192

Added line #L192 was not covered by tests
my @types;
foreach (@{$cfg->{address_types}}) {
foreach (@{$self->address_types}) {

Check warning on line 194 in perllib/Integrations/Echo.pm

View check run for this annotation

Codecov / codecov/patch

perllib/Integrations/Echo.pm#L194

Added line #L194 was not covered by tests
my $obj = _id_ref($_, 'PointAddressType');
push @types, { ObjectRef => $obj };
}
Expand All @@ -200,7 +200,7 @@
return [
{ Description => '1 Example Street, Bromley, BR1 1AA', Id => '11345', SharedRef => { Value => { anyType => '1000000001' } } },
{ Description => '2 Example Street, Bromley, BR1 1AA', Id => '12345', SharedRef => { Value => { anyType => '1000000002' } } },
$cfg->{address_types} ? () : ({ Description => '3 Example Street, Bromley, BR1 1AA', Id => '13345', SharedRef => { Value => { anyType => '1000000003' } } }),
$self->address_types ? () : ({ Description => '3 Example Street, Bromley, BR1 1AA', Id => '13345', SharedRef => { Value => { anyType => '1000000003' } } }),
{ Description => '4 Example Street, Bromley, BR1 1AA', Id => '14345', SharedRef => { Value => { anyType => '1000000004' } } },
{ Description => '5 Example Street, Bromley, BR1 1AA', Id => '15345', SharedRef => { Value => { anyType => '1000000005' } } },
] if $self->sample_data;
Expand Down
Loading