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;
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 {
=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
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;