| 1 | package WebService::ILS::RecordedBooks::Patron; | ||||||||||
| 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::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<WebService::ILS::RecordedBooks::Patron> - services | ||||||||||
| 20 | that require patron credentials | ||||||||||
| 21 | |||||||||||
| 22 | See L<WebService::ILS::RecordedBooks> | ||||||||||
| 23 | |||||||||||
| 24 | =cut | ||||||||||
| 25 | |||||||||||
| 26 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | 1 | ▶ | use parent qw(WebService::ILS::RecordedBooks); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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<user_id> | ||||||||||
| 39 | |||||||||||
| 40 | =item C<password> | ||||||||||
| 41 | |||||||||||
| 42 | =back | ||||||||||
| 43 | |||||||||||
| 44 | =cut | ||||||||||
| 45 | |||||||||||
| 46 | 1 | ▶ | use Class::Tiny qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 47 | user_id password | ||||||||||
| 48 | 1 | ); | |||||||||
| 49 | |||||||||||
| 50 | 1 | __PACKAGE__->_set_param_spec({ | |||||||||
| 51 | user_id => { required => 1 }, | ||||||||||
| 52 | password => { required => 1 }, | ||||||||||
| 53 | }); | ||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub _access_auth_string { | ||||||||
|
Subroutine
_access_auth_string: not called CC=1 SCAR=6.9
| |||||||||||
| 57 | 0 | my $self = shift; | |||||||||
| 58 | 0 | return $self->client_secret; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub _extract_token_from_response { | ||||||||
|
Subroutine
_extract_token_from_response: not called CC=1 SCAR=6.9
| |||||||||||
| 62 | 0 | my $self = shift; | |||||||||
| 63 | 0 | my $data = shift; | |||||||||
| 64 | |||||||||||
| 65 | 0 | return ($data->{bearer}, "bearer"); | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 0 | ▶ | sub make_access_token_request { | ||||||||
|
Subroutine
make_access_token_request: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 69 | 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 | 0 | ▶ | sub title_url { | ||||||||
|
Subroutine
title_url: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 82 | 0 | my $self = shift; | |||||||||
| 83 | 0 | ▶ | my $isbn = shift or croak "No isbn"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 84 | 0 | return $self->api_url("/titles/$isbn"); | |||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | 0 | ▶ | sub circulation_action_base_url { | ||||||||
|
Subroutine
circulation_action_base_url: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 88 | 0 | my $self = shift; | |||||||||
| 89 | |||||||||||
| 90 | 0 | return $self->api_url("/transactions"); | |||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | 1 | 1; | |||||||||
| 94 | |||||||||||
| 95 | __END__ | ||||||||||