}
# get basic metadata for an item (title, author, cover image if any)
-# GET http://api.oneclickdigital.us/v1/libraries/{libraryId}/titles/{isbn}
+# GET http://api.oneclickdigital.us/v1/libraries/{libraryId}/media/{isbn}
sub get_title_info {
my ($self, $isbn) = @_;
my $base_uri = $self->{base_uri};
my $session_id = $self->{session_id};
my $req = {
method => 'GET',
- uri => "$base_uri/libraries/$library_id/titles/$isbn"
+ uri => "$base_uri/libraries/$library_id/media/$isbn"
};
my $res = $self->request($req, $session_id);
if (defined ($res)) {
return {
title => $res->{content}->{title},
- author => $res->{content}->{authors}[0]{text}
+ author => $res->{content}->{authors}
};
} else {
$logger->error("EbookAPI: could not retrieve OneClickdigital title details for ISBN $isbn");
my $session_id = $self->{session_id};
my $req = {
method => 'POST',
- uri => "$base_uri/libraries/$library_id/patrons/$patron_id/checkouts/$isbn"
+ uri => "$base_uri/libraries/$library_id/patrons/$patron_id/checkouts/$isbn",
+ headers => { "Content-Length" => "0" }
};
my $res = $self->request($req, $session_id);
my $session_id = $self->{session_id};
my $req = {
method => 'PUT',
- uri => "$base_uri/libraries/$library_id/patrons/$patron_id/checkouts/$isbn"
+ uri => "$base_uri/libraries/$library_id/patrons/$patron_id/checkouts/$isbn",
+ headers => { "Content-Length" => "0" }
};
my $res = $self->request($req, $session_id);
$logger->info("EbookAPI: received response for OneClickdigital checkouts: " . Dumper $res);
foreach my $checkout (@{$res->{content}}) {
push @$checkouts, {
- xact_id => $checkout->{transactionID},
+ xact_id => $checkout->{transactionId},
title_id => $checkout->{isbn},
due_date => $checkout->{expiration},
- download_url => $checkout->{downloadURL},
+ download_url => $checkout->{downloadUrl},
title => $checkout->{title},
author => $checkout->{authors}
};
$logger->info("EbookAPI: received response for OneClickdigital holds: " . Dumper $res);
foreach my $hold (@{$res->{content}}) {
push @$holds, {
- xact_id => $hold->{transactionID},
+ xact_id => $hold->{transactionId},
title_id => $hold->{isbn},
expire_date => $hold->{expiration},
title => $hold->{title},