From 0f82d86331b25db6a8078a055dbc5c232e0487d7 Mon Sep 17 00:00:00 2001 From: Scott Collins Date: Thu, 18 Nov 2021 12:59:20 -0800 Subject: [PATCH] Completed docstring for TransactionBuilder.prepare_transaction() --- .../core/outputs/transaction_builder.py | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/pds_doi_service/core/outputs/transaction_builder.py b/src/pds_doi_service/core/outputs/transaction_builder.py index 981ddecd..1fb32109 100644 --- a/src/pds_doi_service/core/outputs/transaction_builder.py +++ b/src/pds_doi_service/core/outputs/transaction_builder.py @@ -43,13 +43,34 @@ def __init__(self, db_name=None): def prepare_transaction(self, node_id, submitter_email, doi, input_path=None, output_content_type=CONTENT_TYPE_XML): """ - Build a Transaction from the inputs and outputs to a 'reserve', 'draft' + Build a Transaction from the inputs and outputs to a reserve, update or release action. The Transaction object is returned. The field output_content is used for writing the content to disk. This is typically the response text from a request to the DOI service provider. + Parameters + ---------- + node_id : str + The node identifier associated with the transaction. + submitter_email : str + The email address associated with the submitter of the transaction + doi : Doi + The DOI object created from the transaction. + input_path : str, optional + Path to the source input file of the provided Doi object. If provided, + the file will be copied to the local transaction history. + output_content_type : str, optional + The format to use for saving the output label to associate with the + transaction. Should be one of xml or json. Defaults to xml. + + Returns + ------- + Transaction + The prepared Transaction object. Callers of this function may call + log() on the returned Transaction to commit it to the local database. + """ if output_content_type not in VALID_CONTENT_TYPES: raise ValueError(f"Invalid content type requested, must be one of {','.join(VALID_CONTENT_TYPES)}")