Continuing work, If you hate the suroutine names now is the time to
authorChris Cormack <chrisc@catalyst.net.nz>
Mon, 18 Nov 2013 02:45:40 +0000 (15:45 +1300)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 18 Nov 2013 02:45:40 +0000 (15:45 +1300)
stop me

lib/NCIP/Handler/LookupItem.pm
lib/NCIP/ILS/Koha.pm
lib/NCIP/Item.pm

index c101fa2..e5cd8da 100644 (file)
@@ -33,6 +33,10 @@ sub handle {
           $xmldoc->getElementsByTagNameNS( $self->namespace(),
             'ItemIdentifierValue' );
         my $item = NCIP::Item->new( { itemid => $item_id->textContent(), ils => $self->ils} );
+        my ($itemdata,$error) = $item->itemdata();
+        if ($error){
+# handle error here
+        }
         warn $item->itemid();
     }
     return $self->type;
index 51156b1..d14256c 100644 (file)
@@ -19,4 +19,9 @@ package NCIP::ILS::Koha;
 use Modern::Perl;
 use Object::Tiny qw{ name };
 
+
+sub itemdata {
+    my $self = shift;
+    return ( {barcode=>'123',title=>'fish'}, undef);
+}
 1;
index 3d9105f..93cfcaf 100644 (file)
@@ -3,6 +3,18 @@ package NCIP::Item;
 use base qw(Class::Accessor);
 
 # Make accessors for the ones that makes sense
-NCIP::Item->mk_accessors(qw(itemid));
+NCIP::Item->mk_accessors(qw(itemid ils));
+
+# Call the apppropriate subroutine in the ILS specific code and get the data
+
+sub itemdata {
+    my $self = shift;
+    my $ils  = $self->ils;
+    my ( $itemdata, $error ) = $ils->itemdata( $self->itemid );
+
+# add anything NCIP specific not handled by the ILS to the itemdata object at this point, if no error
+
+    return $itemdata, $error;
+}
 
 1;