LP#1673870: Handle OverDrive ebook checkout and download
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Tue, 4 Jul 2017 23:20:11 +0000 (16:20 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Fri, 14 Jul 2017 19:12:12 +0000 (12:12 -0700)
commit856fcdae8cd367c0b5cdd2fe9c92e03a81423a12
treebf42cbdcb4513e70731fb992120fcc95bf85cdb8
parent3502b2844f9e0cfebf42c507c6fa8273c121d9c8
LP#1673870: Handle OverDrive ebook checkout and download

The workflow for checking out and downloading a title via the OverDrive
API is relatively complex:

1. Check out a title.

2. Lock in a specific format for the checked-out title.  Once you lock
in a format, you can only download the title in that format -- except
that the browser-based OverDrive Read and OverDrive Listen formats are
always available (if supported for that title), even if you've locked in
another format.

3. Request a link for downloading the title in the specified format.
Download links are dynamically generated and only work for 60 seconds
from the time of your request.

To simplify the process, we require the user to lock in a format during
checkout.  Then, when the user clicks the Download button, we request a
download link; OverDrive responds with a URL, and we immediately
redirect the current browser tab/window to that URL.

A new API call, open-ils.ebook_api.title.get_download_link, has been
added for requesting the download link.  Since API calls are not
vendor-specific, we also add support for the new method in the test
module, complete with unit test.

Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Open-ILS/src/perlmods/lib/OpenILS/Application/EbookAPI.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/EbookAPI/OverDrive.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/EbookAPI/Test.pm
Open-ILS/src/perlmods/live_t/20-lp1541559-ebook-api.t
Open-ILS/web/js/ui/default/opac/ebook_api/ebook.js
Open-ILS/web/js/ui/default/opac/ebook_api/loggedin.js