]> git.evergreen-ils.org Git - working/NCIPServer.git/blob - lib/NCIP/ILS.pm
Add some the Header and Response objects.
[working/NCIPServer.git] / lib / NCIP / ILS.pm
1 # ---------------------------------------------------------------
2 # Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
3 #
4 # This file is part of NCIPServer.
5 #
6 # NCIPServer is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # NCIPServer is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with NCIPServer.  If not, see <http://www.gnu.org/licenses/>.
18 # ---------------------------------------------------------------
19 package NCIP::ILS;
20
21 sub new {
22     my $invocant = shift;
23     my $class = ref $invocant || $invocant;
24     my $self = bless {@_}, $class;
25     return $self;
26 }
27
28 # Methods required for SHAREit:
29
30 sub acceptitem {
31 }
32
33 sub cancelrequestitem {
34 }
35
36 sub checkinitem {
37 }
38
39 sub checkoutitem {
40 }
41
42 sub lookupuser {
43 }
44
45 sub renewitem {
46 }
47
48 sub requestitem {
49 }
50
51 # Other methods, just because.
52
53 sub lookupversion {
54 }
55
56 # A few helper methods:
57
58 # All subclasses will possibly want to create a ResponseHeader and the
59 # code for that would be highly redundant.  We supply a default
60 # implementation here that can retrieve the agency information from
61 # the InitiationHeader of the message, swap their values, and return a
62 # NCIP::Header.
63 sub make_header {
64     my $self = shift;
65     my $initheader = shfit;
66
67     my $header;
68
69     if ($initheader && $initheader->{FromAgencyId}
70             && $initheader->{ToAgencyId}) {
71         $header = NCIP::Header->new(
72             FromAgencyId => $initheader->{ToAgencyId},
73             ToAgencyId => $initheader->{FromAgencyId}
74         );
75     }
76
77     return $header;
78 }
79
80 1;