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)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 31 Aug 2017 15:31:57 +0000 (11:31 -0400)
commit01a79cde3ff8810621f60de0ad3ee3956b56c2fc
tree0f7b4098b7a578fa194289405c8f6689c052c223
parent650ecb6db45fd2fdd56db4a5a98ffebf8ddcbd0e
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.

Supplementary fixes:

- show spinner in My Account while loading from ebook API
- ensure session ID is available to ebook object during transactions
- fix display of ebook formats

Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
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/src/templates/opac/parts/ebook_api/avail_js.tt2
Open-ILS/web/js/ui/default/opac/ebook_api/ebook.js
Open-ILS/web/js/ui/default/opac/ebook_api/loggedin.js