line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::ILS::RecordedBooks::Patron; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
706
|
use Modern::Perl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=encoding utf-8 |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
WebService::ILS::RecordedBooks::Patron - RecordedBooks patron API |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use WebService::ILS::RecordedBooks::Patron; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
L - services |
20
|
|
|
|
|
|
|
that require patron credentials |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
See L |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
90
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
|
5
|
use parent qw(WebService::ILS::RecordedBooks); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 new (%params_hash or $params_hashref) |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head3 Additional constructor params: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over 16 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item C |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item C |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=back |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
7
|
use Class::Tiny qw( |
47
|
|
|
|
|
|
|
user_id password |
48
|
1
|
|
|
1
|
|
75
|
); |
|
1
|
|
|
|
|
3
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__PACKAGE__->_set_param_spec({ |
51
|
|
|
|
|
|
|
user_id => { required => 1 }, |
52
|
|
|
|
|
|
|
password => { required => 1 }, |
53
|
|
|
|
|
|
|
}); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _access_auth_string { |
57
|
0
|
|
|
0
|
|
|
my $self = shift; |
58
|
0
|
|
|
|
|
|
return $self->client_secret; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _extract_token_from_response { |
62
|
0
|
|
|
0
|
|
|
my $self = shift; |
63
|
0
|
|
|
|
|
|
my $data = shift; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return ($data->{bearer}, "bearer"); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub make_access_token_request { |
69
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $url = $self->api_url("/tokens"); |
72
|
0
|
|
|
|
|
|
my %params = ( |
73
|
|
|
|
|
|
|
UserName => $self->user_id, |
74
|
|
|
|
|
|
|
Password => $self->password, |
75
|
|
|
|
|
|
|
LibraryId => $self->library_id, |
76
|
|
|
|
|
|
|
); |
77
|
0
|
|
|
|
|
|
my $req = HTTP::Request::Common::POST( $url ); |
78
|
0
|
|
|
|
|
|
return $self->_json_request_content($req, \%params); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub title_url { |
82
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
83
|
0
|
0
|
|
|
|
|
my $isbn = shift or croak "No isbn"; |
84
|
0
|
|
|
|
|
|
return $self->api_url("/titles/$isbn"); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub circulation_action_base_url { |
88
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return $self->api_url("/transactions"); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |