use NCIP::StructuredPersonalUserName;
use NCIP::StructuredAddress;
use NCIP::ElectronicAddress;
+use NCIP::PhysicalAddress;
use NCIP::RequestId;
use NCIP::Item::Id;
use NCIP::Item::OptionalFields;
foreach my $addr (@{$user->addresses()}) {
next if ($U->is_true($addr->pending()));
my $address = NCIP::User::AddressInformation->new({UserAddressRoleType=>$addr->address_type()});
- my $physical = NCIP::StructuredAddress->new();
- $physical->Line1($addr->street1());
- $physical->Line2($addr->street2());
- $physical->Locality($addr->city());
- $physical->Region($addr->state());
- $physical->PostalCode($addr->post_code());
- $physical->Country($addr->country());
- $address->PhysicalAddress($physical);
+ my $structured = NCIP::StructuredAddress->new();
+ $structured->Line1($addr->street1());
+ $structured->Line2($addr->street2());
+ $structured->Locality($addr->city());
+ $structured->Region($addr->state());
+ $structured->PostalCode($addr->post_code());
+ $structured->Country($addr->country());
+ $address->PhysicalAddress(
+ NCIP::PhysicalAddress->new(
+ {
+ StructuredAddress => $structured,
+ Type => 'Postal Address'
+ }
+ )
+ );
push @$addresses, $address;
}
--- /dev/null
+# ---------------------------------------------------------------
+# Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
+#
+# This file is part of NCIPServer.
+#
+# NCIPServer is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# NCIPServer is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
+# ---------------------------------------------------------------
+package NCIP::PhysicalAddress;
+use parent qw(Class::Accessor);
+
+
+=head1 NAME
+
+PhysicalAddress - A "PhysicalAddress" as defined by Z39.83-1-2012
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+This a "PhysicalAddress" as defined by Z39.83-1-2012. It is used
+for returning user address information when requested. The fields
+are as defined in the standard.
+
+=head1 FIELDS
+
+=head2 StructuredAddress
+
+A NCIP::StructuredAddress object to hold the actual address.
+
+=head2 UnstructuredAddress
+
+Not presently implemented.
+
+=head2 Type
+
+The PhysicalAddressType field. Usually "Postal Address" or "Street Address."
+
+=cut
+
+NCIP::PhysicalAddress->mk_accessors(qw(StructuredAddress Type));
+
+1;
=head2 PhysicalAddress
-A physical address stored in a NCIP::StructuredAddress.
+A physical address stored in a NCIP::PhysicalAddress.
=head2 ElectronicAddress
[% IF element.PhysicalAddress -%]
<PhysicalAddress>
<StructuredAddress>
-<Line1>[% element.PhysicalAddress.Line1 | xml %]</Line1>
-[% IF element.PhysicalAddress.Line2 -%]
-<Line2>[% element.PhysicalAddress.Line2 | xml %]</Line2>
+<Line1>[% element.PhysicalAddress.StructuredAddress.Line1 | xml %]</Line1>
+[% IF element.PhysicalAddress.StructuredAddress.Line2 -%]
+<Line2>[% element.PhysicalAddress.StructuredAddress.Line2 | xml %]</Line2>
[% END -%]
-[% IF element.PhysicalAddress.Locality -%]
-<Locality>[% element.PhysicalAddress.Locality | xml %]</Locality>
+[% IF element.PhysicalAddress.StructuredAddress.Locality -%]
+<Locality>[% element.PhysicalAddress.StructuredAddress.Locality | xml %]</Locality>
[% END -%]
-[% IF element.PhysicalAddress.Region -%]
-<Region>[% element.PhysicalAddress.Region | xml %]</Region>
+[% IF element.PhysicalAddress.StructuredAddress.Region -%]
+<Region>[% element.PhysicalAddress.StructuredAddress.Region | xml %]</Region>
[% END -%]
-[% IF element.PhysicalAddress.Country -%]
-<Country>[% element.PhysicalAddress.Country | xml %]</Country>
+[% IF element.PhysicalAddress.StructuredAddress.Country -%]
+<Country>[% element.PhysicalAddress.StructuredAddress.Country | xml %]</Country>
[% END -%]
-[% IF element.PhysicalAddress.PostalCode -%]
-<PostalCode>[% element.PhysicalAddress.PostalCode | xml %]</PostalCode>
+[% IF element.PhysicalAddress.StructuredAddress.PostalCode -%]
+<PostalCode>[% element.PhysicalAddress.StructuredAddress.PostalCode | xml %]</PostalCode>
[% END -%]
</StructuredAddress>
-<PhysicalAddressType>Postal Address</PhysicalAddressType>
+<PhysicalAddressType>[% element.PhysicalAddress.Type | xml %]</PhysicalAddressType>
</PhysicalAddress>
[% ELSIF element.ElectronicAddress -%]
<ElectronicAddress>