Add lookupversion implemenation to NCIP::ILS.
authorJason Stephenson <jason@sigio.com>
Thu, 7 Aug 2014 11:59:56 +0000 (07:59 -0400)
committerJason Stephenson <jason@sigio.com>
Thu, 7 Aug 2014 11:59:56 +0000 (07:59 -0400)
Also fix a few typos.

Signed-off-by: Jason Stephenson <jason@sigio.com>
lib/NCIP/Header.pm
lib/NCIP/ILS.pm
lib/NCIP/Response.pm

index 0ae1960..d7d5646 100644 (file)
@@ -25,7 +25,7 @@ use parent qw(Class::Accessor);
 # The fields are as defined in Z39.83-1-2012.  Ext is provided but is
 # not used by the current iteration of NCIPServer.
 
-NCIP::Problem->mk_accessors(qw(FromSystemId FromSystemAuthentication
+NCIP::Header->mk_accessors(qw(FromSystemId FromSystemAuthentication
                                FromAgencyId FromAgencyAuthentication
                                ToSystemId ToAgencyId Ext));
 
index 581b009..aae5939 100644 (file)
 # ---------------------------------------------------------------
 package NCIP::ILS;
 
+use Modern::Perl;
+use NCIP::Const;
+use NCIP::Header;
+use NCIP::Response;
+
 sub new {
     my $invocant = shift;
     my $class = ref $invocant || $invocant;
@@ -53,6 +58,17 @@ sub requestitem {
 # Handle a LookupVersion Request.  You probably want to just call this
 # one from your subclasses rather than reimplement it.
 sub lookupversion {
+    my $self = shift;
+    my $request = shift;
+
+    my $response = NCIP::Response->new({type => "LookupVersionResponse"});
+    $response->header($self->make_header($request));
+    my $payload = {
+        versions => [ NCIP::Const::SUPPORTED_VERSIONS ]
+    };
+    $response->data($payload);
+
+    return $response;
 }
 
 # A few helper methods:
index e702d10..00c9266 100644 (file)
@@ -41,6 +41,6 @@ use parent qw(Class::Accessor);
 # supplied the other must be left undefined/unset.  Only 1 header is
 # supported, but it is entirely optional according to the standard.
 
-NCIP::Problem->mk_accessors(qw(type data problem header));
+NCIP::Response->mk_accessors(qw(type data problem header));
 
 1;