Add ElectronicAddress element.
authorJason Stephenson <jason@sigio.com>
Sun, 17 Aug 2014 15:01:14 +0000 (11:01 -0400)
committerJason Stephenson <jason@sigio.com>
Sun, 17 Aug 2014 15:01:14 +0000 (11:01 -0400)
Signed-off-by: Jason Stephenson <jason@sigio.com>
lib/NCIP/ElectronicAddress.pm [new file with mode: 0644]
lib/NCIP/User/AddressInformation.pm
templates/includes/LookupUserResponse.inc

diff --git a/lib/NCIP/ElectronicAddress.pm b/lib/NCIP/ElectronicAddress.pm
new file mode 100644 (file)
index 0000000..08a316c
--- /dev/null
@@ -0,0 +1,48 @@
+# ---------------------------------------------------------------
+# 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::ElectronicAddress;
+
+use parent qw(Class::Accessor);
+
+=head1 NAME
+
+ElectronicAddress - As defined in Z39.83-1-2012
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+=head1 FIELDS
+
+=head2 Type
+
+Text string for the type of the electronic address, email, ip address,
+phone number, etc.
+
+=head2 Data
+
+Text string for the actual address data.
+
+=cut
+
+NCIP::ElectronicAddress->mk_accessors(qw(Type Data));
+
+1;
index abf1c6a..c8886ff 100644 (file)
@@ -32,18 +32,27 @@ AddressInformation - A user's Address Information
 
 =head1 FIELDS
 
+Either one of PhysicalAddress or ElectronicAddress must be defined,
+and they are mutually exclusive, i.e. if one has a value defined, the
+other must be undefined.
+
 =head2 UserAddressRoleType
 
 A text string to indicate the role of the address.
 
 =head2 PhysicalAddress
 
-A physical address stored in a StructuredAddress.
+A physical address stored in a NCIP::StructuredAddress.
+
+=head2 ElectronicAddress
+
+An electronic address or phone number stored in a
+NCIP::ElectronicAddress.
 
 =cut
 
 NCIP::User::AddressInformation->mk_accessors(
-    qw(UserAddressRoleType PhysicalAddress)
+    qw(UserAddressRoleType PhysicalAddress ElectronicAddress)
 );
 
 1;
index f9b64b1..fa2af36 100644 (file)
@@ -39,7 +39,8 @@
 [% IF data.UserOptionalFields.UserAddressInformation -%]
   [% FOREACH element IN data.UserOptionalFields.UserAddressInformation -%]
      <UserAddressInformation>
-      <UserAddressRoleType>[% element.AddressRoleType %]</UserAddressRoleType>
+     <UserAddressRoleType>[% element.AddressRoleType | xml %]</UserAddressRoleType>
+     [% IF element.PhysicalAddress -%]
      <PhysicalAddress>
        <StructuredAddress>
        <Line1>[% element.PhysicalAddress.Line1 | xml %]</Line1>
        [% END -%]
        </StructuredAddress>
      </PhysicalAddress>
+     [% ELSIF element.ElectronicAddress -%]
+     <ElectronicAddress>
+       <ElectronicAddressType>[% element.ElectronicAddress.Type | xml %]</ElectronicAddressType>
+       <ElectronicAddressData>[% element.ElectronicAddress.Data | xml %]</ElectronicAddressData>
+     </ElectronicAddress>
+     [% END -%]
      </UserAddressInformation>
   [% END -%]
 [% END -%]