/
BiblioCommons.pm
68 lines (52 loc) · 1.91 KB
/
BiblioCommons.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package Koha::Plugin::Com::Theke::BiblioCommons;
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program comes with ABSOLUTELY NO WARRANTY;
use Modern::Perl;
use base qw(Koha::Plugins::Base);
use Mojo::JSON qw(decode_json);;
our $VERSION = "{VERSION}";
our $metadata = {
name => 'BiblbioCommons connector plugin for Koha',
author => 'Theke Solutions',
date_authored => '2018-08-23',
date_updated => "2018-08-23",
minimum_version => '18.05.00.000',
maximum_version => undef,
version => $VERSION,
description => 'This plugin implements API endpoints required'
. 'for the integration of BiblioCommons with Koha.'
};
sub new {
my ( $class, $args ) = @_;
## We need to add our metadata here so our base class can access it
$args->{'metadata'} = $metadata;
$args->{'metadata'}->{'class'} = $class;
## Here, we call the 'new' method for our base class
## This runs some additional magic and checking
## and returns our actual $self
my $self = $class->SUPER::new($args);
return $self;
}
sub api_routes {
my ( $self, $args ) = @_;
my $spec_str = $self->mbf_read('openapi.json');
my $spec = decode_json($spec_str);
return $spec;
}
sub api_namespace {
my ( $self ) = @_;
return 'bibliocommons';
}
1;