How to use the zenpy.lib.util.get_object_type 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_cache / test_cache.py View on Github external
def test_cache_object(self):
        cache_key = 1
        ticket = self.cache_item(id=cache_key)
        self.assertIs(self.cache.get(get_object_type(ticket), cache_key), ticket)
github facetoe / zenpy / zenpy / lib / mapping.py View on Github external
def format_key(self, key, parent):
        if key == 'result':
            key = "{}_result".format(get_object_type(parent))
        elif key in ('metadata', 'from', 'system', 'photo', 'thumbnails'):
            key = '{}'.format(key)
        return key
github facetoe / zenpy / zenpy / lib / request.py View on Github external
def build_payload(self, translation):
        return {get_object_type(translation): self.api._serialize(translation)}
github facetoe / zenpy / zenpy / lib / request.py View on Github external
def build_payload(self, help_centre_object):
        return {get_object_type(help_centre_object): self.api._serialize(help_centre_object)}
github facetoe / zenpy / zenpy / lib / cache.py View on Github external
def in_cache(self, zenpy_object):
        """ Determine whether or not this object is in the cache """
        object_type = get_object_type(zenpy_object)
        cache_key_attr = self._cache_key_attribute(object_type)
        return self.get(object_type, getattr(zenpy_object, cache_key_attr)) is not None
github facetoe / zenpy / zenpy / lib / request.py View on Github external
def build_payload(self, translation):
        return {get_object_type(translation): self.api._serialize(translation)}
github facetoe / zenpy / zenpy / lib / request.py View on Github external
def build_payload(self, account):
        return {get_object_type(account): self.api._serialize(account)}
github facetoe / zenpy / zenpy / lib / cache.py View on Github external
def should_cache(self, zenpy_object):
        """ Determine whether or not this object should be cached (ie, a cache exists for it's object_type) """
        return get_object_type(zenpy_object) in self.mapping