def get(cls, id, automation, api=None): """ Fetches the resource from the server. :param id: Automation member username :param automation: Automation id or object :param api: sevenbridges Api instance. :return: AutomationMember object. """ username = Transform.to_resource(id) automation = Transform.to_automation(automation) api = api or cls._API member = api.get(url=cls._URL['get'].format(automation_id=automation, id=username)).json() return AutomationMember(api=api, **member)
def get(cls, id, api=None): """ Fetches the resource from the server. :param id: Resource identifier :param api: sevenbridges Api instance. :return: Resource object. """ id = Transform.to_resource(id) api = api if api else cls._API if 'get' in cls._URL: extra = {'resource': cls.__name__, 'query': {'id': id}} logger.info('Fetching {} resource'.format(cls), extra=extra) resource = api.get(url=cls._URL['get'].format(id=id)).json() return cls(api=api, **resource) else: raise SbgError('Unable to retrieve resource!')
def get(cls, id, api=None): """ Fetches the resource from the server. :param id: Resource identifier :param api: sevenbridges Api instance. :return: Resource object. """ id = Transform.to_resource(id) api = api if api else cls._API if 'get' in cls._URL: extra = {'resource': cls.__name__, 'query': {'id': id}} logger.info('Fetching {} resource'.format(cls), extra=extra) resource = api.get(url=cls._URL['get'].format(id=id)).json() return cls(api=api, **resource) else: raise SbgError('Unable to fetch resource!')