Closed kelynch closed 3 years ago
Example from alma_rb gem for accessing user objects:
require 'alma'
Alma.configure do |config|
config.apikey = 'X'
# ...
end
$primary_identifier = "john.doe"
u = Alma::User.find($primary_identifier)
# Methods
$ ls u
Alma::User#methods:
[] loans preferred_name save!
[]= loggable preferred_suffix to_json
email method_missing renew_all_loans total_fines
fines preferred_email renew_loan total_loans
has_key? preferred_first_name renew_multiple_loans total_requests
id preferred_last_name requests validate
keys preferred_middle_name response
First fetches patron "first_name", "last_name", "barcode" from bibdata using the netit.
Then it hits voyager to get the account object with the following properties:
Block info needs to be added to the bibdata response so it can be pulled from the patron without an additional API call. Block data from alma looks like
"user_block": [
{
"segment_type": "Internal",
"block_type": {
"value": "LOAN"
},
"block_description": {
"value": "CONSORTIA"
},
"block_status": "string",
"block_note": "string",
"created_by": "string",
"created_date": "2024-05-30T09:30:10Z",
"expiry_date": "2019-12-18T14:36:48.659Z"
}
],
How does this map onto our current values?
Here's some example block data from voyager:
<myac:borrowingBlocks>
<myac:title>Blocks</myac:title>
<myac:clusterBorrowingBlocks>
<myac:cluster>
<myac:clusterName>Princeton University Library</myac:clusterName>
<myac:ubSiteId>1@PRINCETONDB20050302104001</myac:ubSiteId>
</myac:cluster>
<myac:borrowingBlock>
<myac:blockReason>odue_recall_limit_patron</myac:blockReason>
<myac:blockCount>1</myac:blockCount>
<myac:blockCode>21</myac:blockCode>
<myac:blockLimit>1</myac:blockLimit>
<myac:itemType xsi:nil="true" />
<myac:pendingHoldCount xsi:nil="true" />
<myac:patronGroupName>Faculty and Professional Staff</myac:patronGroupName>
</myac:borrowingBlock>
</myac:clusterBorrowingBlocks>
</myac:borrowingBlocks>
avail_items
and request_items
I think would both come from the user requests GET endpoint.
Data coming back looks like: https://developers.exlibrisgroup.com/alma/apis/docs/xsd/rest_user_requests.xsd/?tags=GET
itemID
: we get a holding_id will that work? This is for using to cancel the request. Maybe there is a request id.itemTitle
: chapter_or_article_titleexpireDate
: not given? we get last_interest_date, booking_start_date, and booking_end_date. Not sure if any of those are relevant herepickuplocation
: pickup_location_library and pickup_location_circulation_deskqueuePosition
: not given. I do see it in the alma patron UI. Is there another way to get this? Probably can just not display this anymore.charged_items will come from the user loans get endpoint
use expand=renewable to get renewable value.
looks like these will need to be filtered for active loans (see loan_status
) value of loan object.
itemId
: we get barcode, mms_id, holding_id, item_id. Is item_id what we want? This value will be used for renewal; figure out what the renew endpoint uses.renewable
: renewabletitle
: titledueDate
: due_datefines_fees will come from the user fines endpoint. Returns active fees by default. Is that what we want?
date
: creation_timetitle
: titlepostingType
: type description (but from the example it looks like the api only sends the type value? maybe we can ask them to add the description)amount
: original_amountbalance
: balanceYes, active fees would be what we want to display. We didn't have the option to display past fees in Voyager so that would be new functionality that could potentially added to allow users to see their paid/cancelled fines.
https://github.com/tulibraries/alma_rb/blob/main/lib/alma/user.rb#L9 this expand
option is making me think there's an undocumented option on https://developers.exlibrisgroup.com/alma/apis/docs/users/R0VUIC9hbG1hd3MvdjEvdXNlcnM=/ to get everything we need in 1 call. If so we'd pull it through the bibdata endpoint.
update: that expand only gives the total numbers / amounts. But if we pull that we can use it to determine whether we need to hit the other endpoints.
204 No Content
on success.This issue is blocked pending a decision on whether to use alma's "library card" page instead of reimplementing this in blacklight.
Arguments in favor of using the alma page:
There are a few considerations we need to iron out:
Work for this issue is in progress on branch 2025-alma-account if/when we pick it up again.
closing in favor of #2401
Use the switch created in #2362
The following sections of the account page need to be reimplemented for alma:
Relevant areas of the code:
Areas of the page not affected:
Implementation notes:
Other Notes: