foliolib.folio.api.financeStorage.Ledger
- class foliolib.folio.api.financeStorage.Ledger(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApimod-finance-storage (Ledgers)
CRUD APIs used to manage ledgers.
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_ledger(ledgersId)Delete ledger item with given {ledgerId}
get_ledger(ledgersId)Retrieve ledger item with given {ledgerId}
get_ledgers(**kwargs)Get list of ledgers
modify_ledger(ledgersId, ledger)Update ledger item with given {ledgerId}
set_ledger(ledger)Create a new ledger item.
- delete_ledger(ledgersId: str)
Delete ledger item with given {ledgerId}
DELETE /finance-storage/ledgers/{ledgersId}- Parameters
ledgersId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_ledger(ledgersId: str)
Retrieve ledger item with given {ledgerId}
GET /finance-storage/ledgers/{ledgersId}- Parameters
ledgersId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A financial ledger", "type": "object", "properties": { "id": { "description": "UUID of this ledger", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "name": { "description": "The name of the ledger", "type": "string" }, "code": { "description": "The code for the ledger", "type": "string" }, "description": { "description": "The description of the ledger", "type": "string" }, "fiscalYearOneId": { "description": "UUID of the first fiscal year associated with this ledger", "$ref": "../../common/schemas/uuid.json" }, "ledgerStatus": { "description": "The status of the ledger", "type": "string", "enum": [ "Active", "Inactive", "Frozen" ] }, "allocated": { "description": "The amount currently allocated to this ledger", "type": "number", "readonly": true }, "available": { "description": "The amount currently available in this ledger", "type": "number", "readonly": true }, "netTransfers": { "description": "Summing all the transfers from/to this ledger. Amount can be negative", "type": "number", "readonly": true }, "unavailable": { "description": "The amount already utilized from the allocated amount", "type": "number", "readonly": true }, "currency": { "description": "The ISO code for currency", "type": "string" }, "acqUnitIds": { "description": "acquisition unit ids associated with this ledger", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "restrictEncumbrance": { "description": "If true, imposes restrictions on encumbrances", "type": "boolean", "default": true }, "restrictExpenditures": { "description": "If true, imposes restrictions on payments", "type": "boolean", "default": true }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true }, "initialAllocation": { "description": "Summary of all related to this ledger budgets initialAllocation", "type": "number", "readonly": true }, "allocationTo": { "description": "Summary of all related to this ledger budgets allocationTo", "type": "number", "readonly": true }, "allocationFrom": { "description": "Summary of all related to this ledger budgets allocationFrom", "type": "number", "readonly": true }, "totalFunding": { "description": "Summary of all related to this ledger budgets totalFunding", "type": "number", "readonly": true }, "cashBalance": { "description": "Summary of all related to this ledger budgets cashBalance", "type": "number", "readonly": true }, "awaitingPayment": { "description": "Summary of all related to this ledger budgets awaitingPayment", "type": "number", "readonly": true }, "encumbered": { "description": "Summary of all related to this ledger budgets encumbered", "type": "number", "readonly": true }, "expenditures": { "description": "Summary of all related to this ledger budgets expenditures", "type": "number", "readonly": true }, "overEncumbrance": { "description": "Summary of all related to this ledger budgets overEncumbrance", "type": "number", "readonly": true }, "overExpended": { "description": "Summary of all related to this ledger budgets overExpended", "type": "number", "readonly": true } }, "additionalProperties": false, "required": [ "name", "code", "fiscalYearOneId", "ledgerStatus", "restrictEncumbrance", "restrictExpenditures" ] }
- get_ledgers(**kwargs)
Get list of ledgers
GET /finance-storage/ledgers- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
query (str) –
A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://dev.folio.org/reference/glossary#cql)) using valid searchable fields. The first example below shows the general form of a full CQL query, but those fields might not be relevant in this context.
with valid searchable fields: for example code
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
[“code”, “MEDGRANT”, “=”]
totalRecords (str) –
(default=auto) How to calculate the totalRecords property. “exact” for the correct number, “estimated” for an estimation, “auto” to automatically select “exact” or “estimated”, “none” for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords
Example
none
offset (int) –
(default=0) Skip over a number of elements by specifying an offset value for the query
Example
0
limit (int) –
(default=10) Limit the number of elements returned in the response
Example
10
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A collection of ledgers", "type": "object", "properties": { "ledgers": { "description": "Collection of ledger records", "type": "array", "id": "ledgers", "items": { "type": "object", "$ref": "ledger.json" } }, "totalRecords": { "description": "The number of objects contained in this collection", "type": "integer" } }, "additionalProperties": false, "required": [ "ledgers", "totalRecords" ] }
- modify_ledger(ledgersId: str, ledger: dict)
Update ledger item with given {ledgerId}
PUT /finance-storage/ledgers/{ledgersId}- Parameters
ledgersId (str) –
ledger (dict) – See Schema below
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiRequestConflict – Conflict
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A financial ledger", "type": "object", "properties": { "id": { "description": "UUID of this ledger", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "name": { "description": "The name of the ledger", "type": "string" }, "code": { "description": "The code for the ledger", "type": "string" }, "description": { "description": "The description of the ledger", "type": "string" }, "fiscalYearOneId": { "description": "UUID of the first fiscal year associated with this ledger", "$ref": "../../common/schemas/uuid.json" }, "ledgerStatus": { "description": "The status of the ledger", "type": "string", "enum": [ "Active", "Inactive", "Frozen" ] }, "allocated": { "description": "The amount currently allocated to this ledger", "type": "number", "readonly": true }, "available": { "description": "The amount currently available in this ledger", "type": "number", "readonly": true }, "netTransfers": { "description": "Summing all the transfers from/to this ledger. Amount can be negative", "type": "number", "readonly": true }, "unavailable": { "description": "The amount already utilized from the allocated amount", "type": "number", "readonly": true }, "currency": { "description": "The ISO code for currency", "type": "string" }, "acqUnitIds": { "description": "acquisition unit ids associated with this ledger", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "restrictEncumbrance": { "description": "If true, imposes restrictions on encumbrances", "type": "boolean", "default": true }, "restrictExpenditures": { "description": "If true, imposes restrictions on payments", "type": "boolean", "default": true }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true }, "initialAllocation": { "description": "Summary of all related to this ledger budgets initialAllocation", "type": "number", "readonly": true }, "allocationTo": { "description": "Summary of all related to this ledger budgets allocationTo", "type": "number", "readonly": true }, "allocationFrom": { "description": "Summary of all related to this ledger budgets allocationFrom", "type": "number", "readonly": true }, "totalFunding": { "description": "Summary of all related to this ledger budgets totalFunding", "type": "number", "readonly": true }, "cashBalance": { "description": "Summary of all related to this ledger budgets cashBalance", "type": "number", "readonly": true }, "awaitingPayment": { "description": "Summary of all related to this ledger budgets awaitingPayment", "type": "number", "readonly": true }, "encumbered": { "description": "Summary of all related to this ledger budgets encumbered", "type": "number", "readonly": true }, "expenditures": { "description": "Summary of all related to this ledger budgets expenditures", "type": "number", "readonly": true }, "overEncumbrance": { "description": "Summary of all related to this ledger budgets overEncumbrance", "type": "number", "readonly": true }, "overExpended": { "description": "Summary of all related to this ledger budgets overExpended", "type": "number", "readonly": true } }, "additionalProperties": false, "required": [ "name", "code", "fiscalYearOneId", "ledgerStatus", "restrictEncumbrance", "restrictExpenditures" ] }
- set_ledger(ledger: dict)
Create a new ledger item.
POST /finance-storage/ledgers- Parameters
ledger (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Headers
Location - URI to the created ledger item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A financial ledger", "type": "object", "properties": { "id": { "description": "UUID of this ledger", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "name": { "description": "The name of the ledger", "type": "string" }, "code": { "description": "The code for the ledger", "type": "string" }, "description": { "description": "The description of the ledger", "type": "string" }, "fiscalYearOneId": { "description": "UUID of the first fiscal year associated with this ledger", "$ref": "../../common/schemas/uuid.json" }, "ledgerStatus": { "description": "The status of the ledger", "type": "string", "enum": [ "Active", "Inactive", "Frozen" ] }, "allocated": { "description": "The amount currently allocated to this ledger", "type": "number", "readonly": true }, "available": { "description": "The amount currently available in this ledger", "type": "number", "readonly": true }, "netTransfers": { "description": "Summing all the transfers from/to this ledger. Amount can be negative", "type": "number", "readonly": true }, "unavailable": { "description": "The amount already utilized from the allocated amount", "type": "number", "readonly": true }, "currency": { "description": "The ISO code for currency", "type": "string" }, "acqUnitIds": { "description": "acquisition unit ids associated with this ledger", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "restrictEncumbrance": { "description": "If true, imposes restrictions on encumbrances", "type": "boolean", "default": true }, "restrictExpenditures": { "description": "If true, imposes restrictions on payments", "type": "boolean", "default": true }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true }, "initialAllocation": { "description": "Summary of all related to this ledger budgets initialAllocation", "type": "number", "readonly": true }, "allocationTo": { "description": "Summary of all related to this ledger budgets allocationTo", "type": "number", "readonly": true }, "allocationFrom": { "description": "Summary of all related to this ledger budgets allocationFrom", "type": "number", "readonly": true }, "totalFunding": { "description": "Summary of all related to this ledger budgets totalFunding", "type": "number", "readonly": true }, "cashBalance": { "description": "Summary of all related to this ledger budgets cashBalance", "type": "number", "readonly": true }, "awaitingPayment": { "description": "Summary of all related to this ledger budgets awaitingPayment", "type": "number", "readonly": true }, "encumbered": { "description": "Summary of all related to this ledger budgets encumbered", "type": "number", "readonly": true }, "expenditures": { "description": "Summary of all related to this ledger budgets expenditures", "type": "number", "readonly": true }, "overEncumbrance": { "description": "Summary of all related to this ledger budgets overEncumbrance", "type": "number", "readonly": true }, "overExpended": { "description": "Summary of all related to this ledger budgets overExpended", "type": "number", "readonly": true } }, "additionalProperties": false, "required": [ "name", "code", "fiscalYearOneId", "ledgerStatus", "restrictEncumbrance", "restrictExpenditures" ] }