--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2023 by Frank Brehm, Publicies Pixelpark GmbH, Berlin
+@summary: A module for encapsulating the owner information of a forge module.
+"""
+from __future__ import absolute_import
+
+# Standard modules
+import logging
+
+# Own modules
+
+from ..xlate import XLATOR
+
+from . import BaseForgeObject
+
+__version__ = '0.3.0'
+
+LOG = logging.getLogger(__name__)
+
+_ = XLATOR.gettext
+ngettext = XLATOR.ngettext
+
+
+# =============================================================================
+class ForgeOwnerInfo(BaseForgeObject):
+ """Class for encapsulating information about an module owner in Puppet forge."""
+
+ # -------------------------------------------------------------------------
+ def __init__(
+ self, gravatar_id=None, slug=None, uri=None, username=None,
+ appname=None, verbose=0, version=__version__, base_dir=None, initialized=None):
+
+ self._gravatar_id = None
+ self._username = None
+
+ super(ForgeOwnerInfo, self).__init__(
+ slug=slug, uri=uri, appname=appname, verbose=verbose, version=version,
+ base_dir=base_dir, initialized=False)
+
+ self.gravatar_id = gravatar_id
+ self.username = username
+
+ if initialized is not None:
+ self.initialized = initialized
+
+ # -------------------------------------------------------------------------
+ def as_dict(self, short=True):
+ """
+ Transforms the elements of the object into a dict
+
+ @return: structure as dict
+ @rtype: dict
+ """
+
+ res = super(ForgeOwnerInfo, self).as_dict(short=short)
+
+ res['gravatar_id'] = self.gravatar_id
+ res['username'] = self.username
+
+ return res
+
+ # -------------------------------------------------------------------------
+ @property
+ def gravatar_id(self):
+ """The Gravatar-Id of this owner."""
+ return self._gravatar_id
+
+ @gravatar_id.setter
+ def gravatar_id(self, value):
+ if value is None:
+ self._gravatar_id = None
+ return
+ v = str(value).strip()
+ if v == '':
+ self._gravatar_id = None
+ return
+ self._gravatar_id = v
+
+ # -------------------------------------------------------------------------
+ @property
+ def username(self):
+ """The username of this owner."""
+ return self._username
+
+ @username.setter
+ def username(self, value):
+ if value is None:
+ self._username = None
+ return
+ v = str(value).strip()
+ if v == '':
+ self._username = None
+ return
+ self._username = v
+
+ # -------------------------------------------------------------------------
+ def to_data(self):
+ """Returning a dict, which can be used to re-instantiate this owner info."""
+
+ res = super(ForgeOwnerInfo, self).to_data()
+ res['gravatar_id'] = self.gravatar_id
+ res['username'] = self.username
+
+ return res
+
+ # -------------------------------------------------------------------------
+ def apply_to(self, new):
+
+ if not isinstance(new, ForgeOwnerInfo):
+ msg = _("Parameter {p!r} is not of class {c!r}, but of {e!r} instead.").format(
+ p='new', c='ForgeOwnerInfo', e=new.__class__.__name__)
+ raise TypeError(msg)
+
+ super(ForgeOwnerInfo, self).apply_to(new)
+ new.gravatar_id = self.gravatar_id
+ new.username = self.username
+
+ # -------------------------------------------------------------------------
+ def __eq__(self, other):
+
+ if self.verbose > 4:
+ LOG.debug(_("Comparing {} objects ...").format(self.__class__.__name__))
+
+ if not super(ForgeOwnerInfo, self).__eq__(other):
+ return False
+
+ if not isinstance(other, ForgeOwnerInfo):
+ return False
+
+ if self.gravatar_id != other.gravatar_id:
+ return False
+ if self.username != other.username:
+ return False
+
+ return True
+
+ # -------------------------------------------------------------------------
+ def apply_data(self, data):
+
+ super(ForgeOwnerInfo, self).apply_data(data)
+
+ if 'gravatar_id' in data:
+ self.gravatar_id = data['gravatar_id']
+ if 'username' in data:
+ self.username = data['username']
+
+
+# =============================================================================
+if __name__ == "__main__":
+
+ pass
+
+# =============================================================================
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list