Bug 35581: Koha::Illbackend -> Koha::ILL::Backend
Koha/Illbackend.pm -> Koha/ILL/Backend.pm Koha/REST/V1/Illbackends.pm -> Koha/REST/V1/ILL/Backends.pm Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
58bcedc7f5
commit
64c06fa87c
|
|
@ -1,4 +1,4 @@
|
|||
package Koha::Illbackend;
|
||||
package Koha::ILL::Backend;
|
||||
|
||||
# Copyright PTFS Europe 2023
|
||||
#
|
||||
|
|
@ -23,19 +23,19 @@ use base qw(Koha::Object);
|
|||
|
||||
=head1 NAME
|
||||
|
||||
Koha::Illbackend - Koha Illbackend Object class
|
||||
Koha::ILL::Backend - Koha Illbackend Object class
|
||||
|
||||
=head2 Class methods
|
||||
|
||||
=head3 new
|
||||
|
||||
New illbackend
|
||||
New ILL Backend
|
||||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $self = {};
|
||||
my $self = {};
|
||||
return bless $self, $class;
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ sub embed {
|
|||
|
||||
foreach my $embed_req ( split /\s*,\s*/, $embed_header ) {
|
||||
if ( $embed_req eq 'statuses+strings' ) {
|
||||
$return_embed->{statuses} = $self->existing_statuses( $backend_id );
|
||||
$return_embed->{statuses} = $self->existing_statuses($backend_id);
|
||||
}
|
||||
}
|
||||
return $return_embed;
|
||||
|
|
@ -129,7 +129,7 @@ sub embed {
|
|||
|
||||
=head3 _type
|
||||
|
||||
my $type = Koha::Illbackend->_type;
|
||||
my $type = Koha::ILL::Backend->_type;
|
||||
|
||||
Return this object's type
|
||||
|
||||
|
|
@ -1,19 +1,19 @@
|
|||
package Koha::REST::V1::Illbackends;
|
||||
package Koha::REST::V1::ILL::Backends;
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha 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.
|
||||
# Koha 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.
|
||||
#
|
||||
# Koha 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.
|
||||
# Koha 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 Koha; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
|
|
@ -21,11 +21,11 @@ use Mojo::Base 'Mojolicious::Controller';
|
|||
|
||||
use Koha::Illrequest::Config;
|
||||
use Koha::Illrequests;
|
||||
use Koha::Illbackend;
|
||||
use Koha::ILL::Backend;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Koha::REST::V1::Illbackends
|
||||
Koha::REST::V1::ILL::Backends
|
||||
|
||||
=head2 Operations
|
||||
|
||||
|
|
@ -38,9 +38,9 @@ Return a list of available ILL backends and its capabilities
|
|||
sub list {
|
||||
my $c = shift->openapi->valid_input;
|
||||
|
||||
my $config = Koha::Illrequest::Config->new;
|
||||
my $backends = $config->available_backends;
|
||||
my $backend_module = Koha::Illbackend->new;
|
||||
my $config = Koha::ILL::Request::Config->new;
|
||||
my $backends = $config->available_backends;
|
||||
my $backend_module = Koha::ILL::Backend->new;
|
||||
|
||||
my @data;
|
||||
foreach my $b (@$backends) {
|
||||
|
|
@ -73,18 +73,19 @@ sub get {
|
|||
|
||||
return try {
|
||||
|
||||
#FIXME: Should we move load_backend into Koha::Illbackend...
|
||||
#FIXME: Should we move load_backend into Koha::ILL::Backend...
|
||||
# or maybe make Koha::Ill::Backend a base class for all
|
||||
# backends?
|
||||
my $backend = Koha::Illrequest->new->load_backend($backend_id);
|
||||
|
||||
my $backend_module = Koha::Illbackend->new;
|
||||
my $backend_module = Koha::ILL::Backend->new;
|
||||
|
||||
my $embed =
|
||||
$backend_module->embed( $backend_id,
|
||||
$c->req->headers->header('x-koha-embed') );
|
||||
my $embed = $backend_module->embed(
|
||||
$backend_id,
|
||||
$c->req->headers->header('x-koha-embed')
|
||||
);
|
||||
|
||||
#TODO: We need a to_api method in Koha::Illbackend
|
||||
#TODO: We need a to_api method in Koha::ILL::Backend
|
||||
my $return = {
|
||||
ill_backend_id => $backend_id,
|
||||
capabilities => $backend->capabilities,
|
||||
|
|
@ -94,8 +95,7 @@ sub get {
|
|||
status => 200,
|
||||
openapi => $embed ? { %$return, %$embed } : $return,
|
||||
);
|
||||
}
|
||||
catch {
|
||||
} catch {
|
||||
return $c->render(
|
||||
status => 404,
|
||||
openapi => { error => "ILL backend does not exist" }
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
/ill/backends:
|
||||
get:
|
||||
x-mojo-to: Illbackends#list
|
||||
operationId: listIllbackends
|
||||
x-mojo-to: ILL::Backends#list
|
||||
operationId: listIllBackends
|
||||
tags:
|
||||
- ill_backends
|
||||
summary: List ILL backends
|
||||
|
|
@ -52,8 +52,8 @@
|
|||
ill: "1"
|
||||
"/ill/backends/{ill_backend_id}":
|
||||
get:
|
||||
x-mojo-to: Illbackends#get
|
||||
operationId: getIllbackends
|
||||
x-mojo-to: ILL::Backends#get
|
||||
operationId: getIllBackends
|
||||
tags:
|
||||
- ill_backends
|
||||
summary: Get ILL backend
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use Modern::Perl;
|
|||
|
||||
use Test::More tests => 1;
|
||||
|
||||
use Koha::Illbackend;
|
||||
use Koha::ILL::Backend;
|
||||
|
||||
use t::lib::TestBuilder;
|
||||
use t::lib::Mocks;
|
||||
|
|
@ -36,7 +36,7 @@ subtest 'existing_statuses() tests' => sub {
|
|||
$schema->storage->txn_begin;
|
||||
Koha::Illrequests->search->delete;
|
||||
|
||||
# Mock ILLBackend (as object)
|
||||
# Mock external ILLBackend (as object)
|
||||
my $backend = Test::MockObject->new;
|
||||
$backend->set_isa('Koha::Illbackends::Mock');
|
||||
$backend->set_always( 'name', 'Mock' );
|
||||
|
|
@ -133,7 +133,7 @@ subtest 'existing_statuses() tests' => sub {
|
|||
}
|
||||
);
|
||||
|
||||
my $backend_module = Koha::Illbackend->new;
|
||||
my $backend_module = Koha::ILL::Backend->new;
|
||||
|
||||
my $existing_statuses = $backend_module->existing_statuses('Mock');
|
||||
|
||||
Loading…
Reference in New Issue