line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::ILS::RecordedBooks::PartnerBase; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
261
|
use Modern::Perl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=encoding utf-8 |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
WebService::ILS::RecordedBooks::PartnerBase - RecordedBooks partner API |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
See L |
14
|
|
|
|
|
|
|
and L; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
87
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
19
|
1
|
|
|
1
|
|
4
|
use URI::Escape; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
4
|
use parent qw(WebService::ILS::RecordedBooks); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub title_url { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
0
|
0
|
|
|
|
|
my $isbn = shift or croak "No isbn"; |
26
|
0
|
|
|
|
|
|
return $self->library_action_base_url."/titles/$isbn"; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _request_with_token { |
30
|
0
|
|
|
0
|
|
|
my $self = shift; |
31
|
0
|
0
|
|
|
|
|
my $request = shift or croak "No request"; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$request->header( Authorization => "Basic ".$self->client_secret ); |
34
|
0
|
|
|
|
|
|
return $self->user_agent->request( $request ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 CIRCULATION METHOD SPECIFICS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
|
159
|
use constant NATIVE_PATRON_ID_KEY => "patronId"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
188
|
|
42
|
|
|
|
|
|
|
my %PATRON_XLATE = ( |
43
|
|
|
|
|
|
|
NATIVE_PATRON_ID_KEY() => 'id', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
sub patron { |
46
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
47
|
0
|
|
|
|
|
|
return $self->_result_xlate($self->native_patron(@_), \%PATRON_XLATE); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 patron_id ($email_or_id) |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub patron_id { |
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
0
|
0
|
|
|
|
|
my $patron = $self->native_patron(@_) or return; |
57
|
0
|
|
|
|
|
|
return $patron->{NATIVE_PATRON_ID_KEY()}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NATIVE METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 native_patron ($email_or_id) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub native_patron { |
67
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
68
|
0
|
0
|
|
|
|
|
my $cardnum_or_email = shift or croak "No patron identification"; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $url = $self->api_url("/rpc/libraries/".$self->library_id."/patrons/".uri_escape($cardnum_or_email)); |
71
|
0
|
|
|
|
|
|
return $self->get_response($url); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |