Item
class
- class almapiwrapper.inventory.Item(mms_id: Optional[str] = None, holding_id: Optional[str] = None, item_id: Optional[str] = None, zone: Optional[str] = None, env: Optional[Literal['P', 'S']] = 'P', holding: Optional[Holding] = None, barcode: Optional[str] = None, data: Optional[Element] = None, create_item: Optional[bool] = False)
Bases:
Record
Class representing an item.
- There are several possibilities to get item information:
‘get_items’ method of
almapiwrapper.inventory.Holding
objectItem(mms_id, holding_id, item_id, zone, env)
Item(holding=:class:almapiwrapper.inventory.Holding, item_id=item_id)
Item(barcode=’barcode’, zone=’zone’, env=’env’)
- Create an item:
Item(holding=:class:almapiwrapper.inventory.Holding, data=`almapiwrapper.record.XmlData`, create_item=True)
- Variables
item_id – numerical ID of the item
zone – zone of the record
env – environment of the entity: ‘P’ for production and ‘S’ for sandbox
holding –
almapiwrapper.inventory.Holding
objectdata –
almapiwrapper.record.XmlData
object, useful to force update a record from a backup
- Parameters
barcode – string with barcode of the item
mms_id – bib record mms_id
holding_id – holding record ID
create_item – when True, create a new item
- property barcode
Property of the item returning the barcode
- Returns
library code
- static build_headers(data_format: Literal['json', 'xml'], zone: str, area: str, rights: Literal['R', 'RW'] = 'RW', env: Optional[Literal['P', 'S']] = 'P') Dict
Build the headers for the API calls.
- Parameters
data_format – “json” or “xml”
zone – optional, if indicated allow to make the query in an other IZ
area – area of the record, bibs, users for example
rights – “R” for read only or “RW” for write and read rights
env – environment of the api call: ‘P’ for production, ‘S’ for sandbox
- Returns
dict with the headers
- property data: Optional[Union[Dict, Element, DataFrame]]
Property that get xml data with API call. If not available, make an api call
- Returns
xml data, dictionary or pandas dataframe
- delete(self) None
Delete an item.
- Returns
None
- static get_data_from_disk(mms_id, holding_id, item_id, zone)
Fetch the data of the described record
- Parameters
mms_id – bib record mms_id
holding_id – holding record ID
item_id – numerical ID of the item
zone – zone of the record
- Returns
almapiwrapper.record.XmlData
or None
- get_holding_id() str:
Fetch holding ID
- Returns
holding ID
- get_item_id() str
Fetch the item ID in the xml data of ‘data’ attribute. Useful for creating a new item.
- Returns
item id
- get_mms_id(self) str
Fetch IZ MMS ID
- Returns
IZ MMS ID
- get_nz_mms_id(**kwargs)
get_mms_id(self) -> Optional[str] Fetch NZ MMS ID
- Returns
NZ MMS ID
- property holding: Optional[Holding]
Property of the item returning the
almapiwrapper.inventory.Holding
object related to the item- Returns
- property library
Property of the holding returning the library code
- Returns
library code
- property location
Property of the holding returning the library code
- Returns
library code
- save(self) 'Item'
Save a record item in the ‘records’ folder. Versioning is supported. A suffix is added to the file path. Example: records/UBS_9963486250105504/item_22314215800005504_23314215790005504_01.xml
- Returns
Item
- scan_in(self) 'Item'
Scan in an item
- Returns
Item
- update(self) 'Item'
Update items data.
- Returns
Item