How to use the zenpy.lib.api_objects.BaseObject function in zenpy

To help you get started, we’ve selected a few zenpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facetoe / zenpy / tests / test_api / fixtures / __init__.py View on Github external
def recursively_call_properties(self, zenpy_object):
        """ Recursively test that a Zenpy object's properties, and each linked property can be called without error. """
        for attr_name in dir(zenpy_object):
            if isinstance(getattr(type(zenpy_object), attr_name, None), property):
                prop_val = getattr(zenpy_object, attr_name)
                if prop_val and issubclass(prop_val.__class__, BaseObject):
                    self.recursively_call_properties(prop_val)
                elif issubclass(prop_val.__class__, BaseResultGenerator):
                    for obj in prop_val:
                        self.recursively_call_properties(obj)
github facetoe / zenpy / tests / test_api / test_properties.py View on Github external
def iter_classes(mod):
    for cls in vars(mod).values():
        if isinstance(cls, type) and cls not in (BaseObject, ProxyDict, ProxyList):
            yield cls
github facetoe / zenpy / zenpy / lib / api_objects / help_centre_objects.py View on Github external
    @property
    def updated(self):
        """
        |  Comment: When the user segment was last updated
        """
        if self.updated_at:
            return dateutil.parser.parse(self.updated_at)

    @updated.setter
    def updated(self, updated):
        if updated:
            self.updated_at = updated


class Vote(BaseObject):
    """
    ######################################################################
    #    Do not modify, this class is autogenerated by gen_classes.py    #
    ######################################################################
    """

    def __init__(self,
                 api=None,
                 created_at=None,
                 id=None,
                 item_id=None,
                 item_type=None,
                 updated_at=None,
                 url=None,
                 user_id=None,
                 value=None,
github facetoe / zenpy / zenpy / lib / api_objects / chat_objects.py View on Github external
self.region = region
        self.start_date = start_date
        self.user_agent = user_agent

        for key, value in kwargs.items():
            setattr(self, key, value)

        for key in self.to_dict():
            if getattr(self, key) is None:
                try:
                    self._dirty_attributes.remove(key)
                except KeyError:
                    continue


class Shortcut(BaseObject):
    """
    ######################################################################
    #    Do not modify, this class is autogenerated by gen_classes.py    #
    ######################################################################
    """

    def __init__(self,
                 api=None,
                 message=None,
                 name=None,
                 options=None,
                 tags=None,
                 **kwargs):

        self.api = api
github facetoe / zenpy / zenpy / lib / api_objects / chat_objects.py View on Github external
# Read-only: no
        # Type: array
        self.tags = tags

        for key, value in kwargs.items():
            setattr(self, key, value)

        for key in self.to_dict():
            if getattr(self, key) is None:
                try:
                    self._dirty_attributes.remove(key)
                except KeyError:
                    continue


class Trigger(BaseObject):
    """
    ######################################################################
    #    Do not modify, this class is autogenerated by gen_classes.py    #
    ######################################################################
    """

    def __init__(self,
                 api=None,
                 definition=None,
                 description=None,
                 enabled=None,
                 name=None,
                 **kwargs):

        self.api = api
        self.definition = definition
github facetoe / zenpy / zenpy / lib / api_objects / chat_objects.py View on Github external
# Type: string
        self.ip_address = ip_address
        self.visitor = visitor

        for key, value in kwargs.items():
            setattr(self, key, value)

        for key in self.to_dict():
            if getattr(self, key) is None:
                try:
                    self._dirty_attributes.remove(key)
                except KeyError:
                    continue


class Billing(BaseObject):
    """
    ######################################################################
    #    Do not modify, this class is autogenerated by gen_classes.py    #
    ######################################################################
    """

    def __init__(self,
                 api=None,
                 additional_info=None,
                 address1=None,
                 address2=None,
                 city=None,
                 company=None,
                 country_code=None,
                 email=None,
                 first_name=None,
github facetoe / zenpy / zenpy / lib / api_objects / chat_objects.py View on Github external
    @property
    def zendesk_ticket(self):
        """
        |  Description: The ID of the Zendesk Support ticket created from this chat. Available only if using version 2 of the Zendesk Chat-Support integration
        """
        if self.api and self.zendesk_ticket_id:
            return self.api._get_zendesk_ticket(self.zendesk_ticket_id)

    @zendesk_ticket.setter
    def zendesk_ticket(self, zendesk_ticket):
        if zendesk_ticket:
            self.zendesk_ticket_id = zendesk_ticket.id
            self._zendesk_ticket = zendesk_ticket


class Count(BaseObject):
    """
    ######################################################################
    #    Do not modify, this class is autogenerated by gen_classes.py    #
    ######################################################################
    """

    def __init__(self,
                 api=None,
                 agent=None,
                 total=None,
                 visitor=None,
                 **kwargs):

        self.api = api
        self.agent = agent
        self.total = total
github facetoe / zenpy / zenpy / lib / api_objects / help_centre_objects.py View on Github external
from zenpy.lib.api_objects import BaseObject
import dateutil.parser


class AccessPolicy(BaseObject):
    """
    ######################################################################
    #    Do not modify, this class is autogenerated by gen_classes.py    #
    ######################################################################
    """

    def __init__(self,
                 api=None,
                 manageable_by=None,
                 required_tags=None,
                 restricted_to_group_ids=None,
                 restricted_to_organization_ids=None,
                 viewable_by=None,
                 **kwargs):

        self.api = api
github facetoe / zenpy / zenpy / lib / api_objects / chat_objects.py View on Github external
self.agent = agent
        self.total = total
        self.visitor = visitor

        for key, value in kwargs.items():
            setattr(self, key, value)

        for key in self.to_dict():
            if getattr(self, key) is None:
                try:
                    self._dirty_attributes.remove(key)
                except KeyError:
                    continue


class Definition(BaseObject):
    """
    ######################################################################
    #    Do not modify, this class is autogenerated by gen_classes.py    #
    ######################################################################
    """

    def __init__(self,
                 api=None,
                 actions=None,
                 condition=None,
                 event=None,
                 **kwargs):

        self.api = api
        self.actions = actions
        self.condition = condition
github facetoe / zenpy / zenpy / lib / api_objects / chat_objects.py View on Github external
from zenpy.lib.api_objects import BaseObject
import dateutil.parser


class Account(BaseObject):
    """
    ######################################################################
    #    Do not modify, this class is autogenerated by gen_classes.py    #
    ######################################################################
    """

    def __init__(self,
                 api=None,
                 account_key=None,
                 billing=None,
                 create_date=None,
                 plan=None,
                 status=None,
                 **kwargs):

        self.api = api