You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* DACCESS-381: fix punctuation on login page
* DACCESS-257: Fix bug preventing ILL requests from appearing (#118)
* DACCESS-459: Fix bug breaking ReShare lookups (#117)
* Update call to cul-folio-edge authenticate method to specify old auth method (DACCESS-459)
* Update release notes
* Require new version of cul-folio-edge
* Use ILLiad API to retrieve tranactions (DACCESS-257, DACCESS-460)
* Do things the Ruby way
* Comment out things not being used
* Update release notes
* Formatting and docs
---------
Co-authored-by: Melissa Wallace <[email protected]>
* Add filter for ILL transactions (#119)
* DACCESS-459: Fix bug breaking ReShare lookups (#117)
* Update call to cul-folio-edge authenticate method to specify old auth method (DACCESS-459)
* Update release notes
* Require new version of cul-folio-edge
* Use ILLiad API to retrieve tranactions (DACCESS-257, DACCESS-460)
* Do things the Ruby way
* Comment out things not being used
* Update release notes
* Formatting and docs
* Add ILL transaction filter; update release notes
* Fix merge conflict
---------
Co-authored-by: Melissa Wallace <[email protected]>
---------
Co-authored-by: Melissa Wallace <[email protected]>
# This module is an interface for ILLiad. Its primary function is to retrieve an array
2
+
# of ILL transactions for a given user, making use of the ILLiad API. The results are
3
+
# filtered and transformed into a JSON object that can be used by the My Account system.
4
+
moduleILL
5
+
require'rest-client'
6
+
7
+
defill_transactions(user_id)
8
+
transactions=fetch_ill_transactions(user_id)
9
+
# NOTE: The following line should be redundant, but it's here for now, just in case. (See notes in fetch_ill_transactions)
10
+
transactions=filter_by_status(transactions)
11
+
transform_fields(transactions)
12
+
end
13
+
14
+
private
15
+
16
+
# Fetches ILL (Interlibrary Loan) transactions for a given user via the ILLiad API.
17
+
#
18
+
# @param user_id [String] the ID of the user whose transactions are being fetched (netid or guest id)
19
+
# @return [Array<Hash>] an array of objects representing the user's ILL transactions.
20
+
# @raise [RestClient::ExceptionWithResponse] if the request to the ILLiad API fails.
21
+
#
22
+
# The method sends a GET request to the ILLiad API to retrieve the user's ILL transactions.
23
+
# It expects the API key and URL to be set in the environment variables 'MY_ACCOUNT_ILLIAD_API_KEY' and 'MY_ACCOUNT_ILLIAD_API_URL'.
24
+
# A filter is used in the query to try to only retrieve active transactions.
25
+
deffetch_ill_transactions(user_id)
26
+
headers={
27
+
'Accept'=>'application/json',
28
+
'APIKey'=>ENV['MY_ACCOUNT_ILLIAD_API_KEY']
29
+
}
30
+
# The filter is used here because I'm concerned about some users having massive numbers of old, completed transactions. I don't know if this
31
+
# will speed up or slow down the query. In case this doesn't work properly, the filter_by_status method is called again after the query. The three
32
+
# values used to catch completed transactions are the ones used in the old illid6.cgi script.
33
+
filter="not (TransactionStatus eq 'Request Finished' or TransactionStatus eq 'Cancelled by ILL Staff' or TransactionStatus eq 'Cancelled by Customer')"
0 commit comments