Esempio n. 1
0
 def __init__(self, workspace, node_id):
     """
     :param workspace: A Workspace Object for authenticating on Contacthub
     :param node_id: The id of the Contacthub node
     """
     self.workspace = workspace
     self.node_id = str(node_id)
     self.customer_api_manager = _CustomerAPIManager(node=self)
     self.event_api_manager = _EventAPIManager(node=self)
    def __init__(self, node, **attributes):
        """
        Initialize a customer in a node with the specified attributes.

        :param node: the node of the customer supposed to be associated with this event
        :param attributes: key-value arguments for generating the structure of Event's attributes
        """
        convert_properties_obj_in_prop(properties=attributes, properties_class=Properties)
        self.attributes = attributes
        self.node = node
        self.event_api_manager = _EventAPIManager(node=self.node)
    def __init__(self, node, default_attributes=None, **attributes):
        """
        Initialize a customer in a node with the specified attributes.

        :param node: the node of the customer
        :param default_attributes: the attributes schema. By default is the following dictionary:
            {
            'base':
                    {
                    'contacts': {}
                    },
            'extended': {},
            'tags': {
                    'manual': [],
                    'auto': []
                    }
            }
        :param attributes: key-value arguments for generating the structure of Customer's attributes
        """

        convert_properties_obj_in_prop(properties=attributes,
                                       properties_class=Properties)
        if default_attributes is None:
            if 'base' not in attributes:
                attributes['base'] = {}

            if 'contacts' not in attributes['base']:
                attributes['base']['contacts'] = {}

            if 'extended' not in attributes or attributes['extended'] is None:
                attributes['extended'] = {}

            if 'tags' not in attributes or attributes['tags'] is None:
                attributes['tags'] = {'auto': [], 'manual': []}
            self.attributes = attributes
        else:
            default_attributes.update(attributes)
            self.attributes = default_attributes

        self.node = node
        self.customer_api_manager = _CustomerAPIManager(node=self.node)
        self.event_api_manager = _EventAPIManager(node=self.node)
        self.mute = {}