sul-dlss / folio_client

Interface for interacting with the Folio ILS API.
Other
0 stars 0 forks source link

Add methods to client to get "yes, cataloged" for an ETD #7

Closed lwrubel closed 1 year ago

lwrubel commented 1 year ago

Context: This method will get used in the ETD workflow, when hydra_etd checks whether a FOLIO record initially loaded as a stub record is now fully cataloged. When a record has been cataloged in FOLIO, its Instance status gets changed to "Cataloged" which has a code of "cat". This folio_client method will be used in the equivalent of the existing hydra_etd SymphonyChecker#cataloged? service.

The client will need to receive a folio_instance_hrid and a UUID for the instance status "Cataloged". The UUID itself should be the same across FOLIO environments and will be set in the consumer's settings.

This folio_client method should look up the instance record using /instances?query=hrid=={folio_instance_hrid}. For example: /instances?query=hrid==a13250145

The response includes a field 'instances' which contains an array. Only one record should be in that array. Raise an error if more than one is returned.

The client should check whether the value of the record's statusId field matches the status code's UUID which was passed to the client. Return true if the statusId matches. It's possible for a record to not have an instance status and in that case, it won't have a statusId field at all in the instance record JSON.

(As context, hydra_etd will be passing a UUID of 9634a5ab-9228-4703-baf2-4d12ebc77d56 which is for the cat status code, across folio environments. ETDs stub records look like they'll initially have a status corresponding to Uncataloged, and then the cataloger will be changing the status to the "Cataloged" status.)