Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for SLUB Dresden (#553)
* Add SLUB API, implement parseSearchFields and getSupportFlags This API is specific for SLUB in Dresden. * Implement search, searchGetPage, getResultById, prolong, account, checkAccountData * Implement getShareUrl * Add two more mediatypes * Refactor for testing, add tests for account, search result and detailed item * Include year in search results only if not "null" * Correctly process reserved inter-library loan items * Make test of expiry date work independently of locale Format expected date value according to current locale (required for CI testing) * implement cancel * Change search method from POST to GET If the search yields exactly one result then the POST method doesn't return a JSON object but the html catalogue detail web site of this item. Using GET handles this case correctly (returns JSON with one item). * Add MIT license header as requested at https://github.com/opacapp/opacclient/wiki * Change all http requests methods from POST to GET As of Jan 15, 2020, all account POST requests get redirected to the web catalogue login page and POST requests for all search requests get redirected to the html result pages of the web catalogue. * Add remaining details to DetailedItem and fix reserved and lent items * Add SUPPORT_FLAG_ENDLESS_SCROLLING flag to prevent reloading the page the selected result is located on before calling getResultById. * Partly revert d18931b As of Jan 17, 2020, POST requests are accepted again. So we change the account requests back to POST for security reasons (see recommendation https://tools.ietf.org/html/rfc2616#section-15.1.3) * Process boolean status values in account request results and add test for requestAccount * Implement reservation and tests for it - minor fix to SLUBAccountMockTest - combine all SLUB tests into test suite * Fix code analysis issues and simplify isRenewable assignment * Refactor mapping of json array to map for pickup points to simplify code * Add SLUB API, implement parseSearchFields and getSupportFlags This API is specific for SLUB in Dresden. * Implement search, searchGetPage, getResultById, prolong, account, checkAccountData * Implement getShareUrl * Add two more mediatypes * Refactor for testing, add tests for account, search result and detailed item * Include year in search results only if not "null" * Correctly process reserved inter-library loan items * Make test of expiry date work independently of locale Format expected date value according to current locale (required for CI testing) * implement cancel * Change search method from POST to GET If the search yields exactly one result then the POST method doesn't return a JSON object but the html catalogue detail web site of this item. Using GET handles this case correctly (returns JSON with one item). * Add MIT license header as requested at https://github.com/opacapp/opacclient/wiki * Change all http requests methods from POST to GET As of Jan 15, 2020, all account POST requests get redirected to the web catalogue login page and POST requests for all search requests get redirected to the html result pages of the web catalogue. * Add remaining details to DetailedItem and fix reserved and lent items * Add SUPPORT_FLAG_ENDLESS_SCROLLING flag to prevent reloading the page the selected result is located on before calling getResultById. * Partly revert d18931b As of Jan 17, 2020, POST requests are accepted again. So we change the account requests back to POST for security reasons (see recommendation https://tools.ietf.org/html/rfc2616#section-15.1.3) * Process boolean status values in account request results and add test for requestAccount * Implement reservation and tests for it - minor fix to SLUBAccountMockTest - combine all SLUB tests into test suite * Fix code analysis issues and simplify isRenewable assignment * Fix error with no_criteria_input introduced in 118089a - and add tests for search - tests for parseSearchFields - add dropdown search field for access (physical/digital) and fix url build method the prevent issues with space in url query name part * Refactor mapping of json array to map for pickup points to simplify code * Implement renewal for inter-library loan items and tests for it * Fix various code formatting issues * Fix parseSearchFields according to new catalogue homepage 'baseurl' actually gets redirected to https://www.slub-dresden.de/ which then gets redirected to https://www.slub-dresden.de/startseite/. This works as the default 'followRedirects' setting in OkHttpClient Builder() is true. * Fix status message Provide status only if not renewable. Status gives the reason why the item is not renewable (SLUB changed its policy: items can be renewed more than 2 times now) * Remove colon from test resource file name to enable build on Windows systems as colons are not allowed in Windows file names. * Replace ExpectedException.none() by assertThrows as the former became deprecated in JUnit 4.13 * Make lent items status message strings translatable * Fix code analysis warning overriding '@string/copy' which is marked as private in androidx.preference:preference. * Rename string COPY to ITEM_COPY to prevent overriding '@string/copy' which is marked as private in androidx.preference:preference. This basically reverts commit b5ea66f and prevents the warning by renaming instead of marking the string as overriding. * Fix typo and coding conventions issue (lambda argument should be moved out of parentheses) * Add tests for Cancel * Use DummyStringProvider for testing * Add comment about FL = inter-library loan * Simplify code by replacing .map with .forEach * Change JSON getters from opt to get in cases where the item is always available. * Set SearchResult.MediaType to NONE for unknown formats
- Loading branch information