hermes.commands.deposit.invenio_rdm
===================================

.. py:module:: hermes.commands.deposit.invenio_rdm


Classes
-------

.. autoapisummary::

   hermes.commands.deposit.invenio_rdm.InvenioRDMClient
   hermes.commands.deposit.invenio_rdm.InvenioRDMResolver
   hermes.commands.deposit.invenio_rdm.IvenioRDMDepositPlugin


Module Contents
---------------

.. py:class:: InvenioRDMClient(config, auth_token=None, platform_name=None)

   Bases: :py:obj:`hermes.commands.deposit.invenio.InvenioClient`


   A Requests session.

   Provides cookie persistence, connection-pooling, and configuration.

   Basic Usage::

     >>> import requests
     >>> s = requests.Session()
     >>> s.get('https://httpbin.org/get')
     <Response [200]>

   Or as a context manager::

     >>> with requests.Session() as s:
     ...     s.get('https://httpbin.org/get')
     <Response [200]>


   .. py:attribute:: DEFAULT_LICENSES_API_PATH
      :value: 'api/vocabularies/licenses'



   .. py:attribute:: platform_name
      :value: 'invenio_rdm'



   .. py:method:: get_license(license_id: str)


   .. py:method:: get_licenses()


.. py:class:: InvenioRDMResolver(client=None)

   Bases: :py:obj:`hermes.commands.deposit.invenio.InvenioResolver`


   .. py:attribute:: invenio_client_class


   .. py:method:: resolve_license_id(license_url: Optional[str]) -> Optional[dict]

      Deliberately try to resolve the license URL to a valid InvenioRDM license information record from the
      vocabulary.

      First, this method tries to find the license URL in the list of known license vocabulary (which is fetched each
      time, ouch...).

      If the URL is not found (what is pretty probable by now, as CFFConvert produces SPDX-URLs while InvenioRDM still
      relies on the overhauled opensource.org URLs), the SPDX information record is fetched and all valid cross
      references are sought for.

      :return: The vocabulary record that is provided by InvenioRDM.



   .. py:method:: _extract_license_id_from_response(data: dict) -> str
      :staticmethod:



   .. py:method:: _search_license_info(_url: str, valid_licenses: dict) -> Optional[dict]


.. py:class:: IvenioRDMDepositPlugin(command: hermes.commands.deposit.base.HermesDepositCommand, ctx: hermes.model.context.CodeMetaContext, client=None, resolver=None)

   Bases: :py:obj:`hermes.commands.deposit.invenio.InvenioDepositPlugin`


   Base class that implements the generic deposition workflow.

   TODO: describe workflow... needs refactoring to be less stateful!


   .. py:attribute:: platform_name
      :value: 'invenio_rdm'



   .. py:attribute:: invenio_client_class


   .. py:attribute:: invenio_resolver_class


