Bug 30920: (follow-up) Cleanup warning from C4::Biblio::GetAuthorisedValueDesc
[srvgit] / C4 / External / OverDrive.pm
index bed0d55..efc663f 100644 (file)
@@ -20,8 +20,9 @@ package C4::External::OverDrive;
 use strict;
 use warnings;
 
-use JSON;
-use Koha::Cache;
+use Koha;
+use JSON qw( from_json );
+use Koha::Caches;
 use HTTP::Request;
 use HTTP::Request::Common;
 use LWP::Authen::Basic;
@@ -29,17 +30,15 @@ use LWP::UserAgent;
 
 BEGIN {
     require Exporter;
-    our $VERSION = 3.07.00.049;
     our @ISA = qw( Exporter ) ;
     our @EXPORT = qw(
-        IsOverDriveEnabled
         GetOverDriveToken
     );
 }
 
 sub _request {
     my ( $request ) = @_;
-    my $ua = LWP::UserAgent->new( "Koha " . C4::Context->KOHAVERSION );
+    my $ua = LWP::UserAgent->new( agent => "Koha " . $Koha::VERSION );
 
     my $response;
     eval {
@@ -63,23 +62,6 @@ This module provides content search for OverDrive,
 
 =over
 
-=item IsOverDriveEnabled
-
-Returns 1 if all of the necessary system preferences for OverDrive are set.
-
-=back
-
-=cut
-
-sub IsOverDriveEnabled {
-    return (
-        C4::Context->preference( 'OverDriveClientKey' ) &&
-        C4::Context->preference( 'OverDriveClientSecret' )
-    );
-}
-
-=over
-
 =item GetOverDriveToken
 
 Fetches an OAuth2 auth token for the OverDrive API, reusing an existing token in
@@ -99,7 +81,7 @@ sub GetOverDriveToken {
 
     my $cache;
 
-    eval { $cache = Koha::Cache->get_instance() };
+    eval { $cache = Koha::Caches->get_instance() };
 
     my $token;
     $cache and $token = $cache->get_from_cache( "overdrive_token" ) and return $token;