package FixMyStreet::Geocode::Address;
use strict;
use warnings;
use overload '""' => \&as_string, fallback => 1;
sub new {
my ($class, $data) = @_;
my $self = { %$data };
bless $self, $class;
}
sub as_string {
my $self = shift;
my $data = sprintf(_("Nearest road to the pin placed on the map (automatically generated by Bing Maps): %s"),
$self->{name}) . "\n\n";
if ($self->{postcode}) {
$data .= sprintf(_("Nearest postcode to the pin placed on the map (automatically generated): %s (%sm away)"),
$self->{postcode}{postcode}, $self->{postcode}{distance}) . "\n\n";
}
return $data;
}
1;