ILS/OverDrive/Library.pm

filter: Statementstmt 48.2% 14 / 29 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 25.0% 1 / 4 totaltotal 40.4% 19 / 47 CC 4 SCAR 16.3
CC
4
Cov
40%
collection_token
12.0
native_library_account
6.0
make_access_token_request
2.0
CRAP 5.1
« ILS/RecordedBooks/Partner.pm ↑ Summary ILS/RecordedBooks/PartnerPatron.pm »
1 package WebService::ILS::OverDrive::Library;
2  
3 1 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =encoding utf-8
6  
7 =head1 NAME
8  
9 WebService::ILS::OverDrive::Library - WebService::ILS module for OverDrive
10 discovery only services
11  
12 =head1 SYNOPSIS
13  
14 use WebService::ILS::OverDrive::Library;
15  
16 =head1 DESCRIPTION
17  
18 See L<WebService::ILS::OverDrive>
19  
20 =cut
21  
22 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use HTTP::Request::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 ▶use parent qw(WebService::ILS::OverDrive);
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 1 __PACKAGE__->_set_param_spec({
28 library_id => { required => 1, defined => 1 },
29 });
30  
31 0 ▶sub make_access_token_request {
Subroutine make_access_token_request: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my $self = shift;
33  
34 0 return HTTP::Request::Common::POST( 'https://oauth.overdrive.com/token', {
35 grant_type => 'client_credentials'
36 } );
37 }
38  
39 0 ▶sub collection_token {
Subroutine collection_token: not called CC=3 SCAR=24.8
Pod undocumented
40 0 my $self = shift;
41  
42 0 ▶ if (my $collection_token = $self->SUPER::collection_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $collection_token = $self->SUPER::collection_token) 0 0 0
43 0 return $collection_token;
44 }
45
46 0 $self->native_library_account;
47 0 ▶ my $collection_token = $self->SUPER::collection_token
Branch: 1 branch
BranchTrueFalseTotal
my $collection_token = $self->SUPER::collection_token or die "Library has no collections\n" 0 0 0
48 or die "Library has no collections\n";
49 0 return $collection_token;
50 }
51  
52 =head1 NATIVE METHODS
53  
54 =head2 native_library_account ()
55  
56 See L<https://developer.overdrive.com/apis/library-account>
57  
58 =cut
59  
60 0 ▶sub native_library_account {
Subroutine native_library_account: not called CC=2 SCAR=17.9
Pod documented
61 0 my $self = shift;
62  
63 0 my $library = $self->get_response($self->library_url);
64 0 ▶ if (my $collection_token = $library->{collectionToken}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $collection_token = $library->{"collectionToken"}) 0 0 0
65 0 $self->SUPER::collection_token( $collection_token);
66 }
67 0 return $library;
68 }
69  
70 # Discovery helpers
71  
72 0 ▶sub library_url {
Subroutine library_url: not called CC=1 SCAR=6.9
Pod undocumented
73 0 my $self = shift;
74 0 return $self->discovery_action_url("/libraries/".$self->library_id);
75 }
76  
77 1 1;
78  
79 __END__
« ILS/RecordedBooks/Partner.pm ↑ Summary ILS/RecordedBooks/PartnerPatron.pm »