From c30a828f53dbe6c9e8321134ca24cf8b79fea62a Mon Sep 17 00:00:00 2001 From: Nikolas Engelhard Date: Sun, 30 Jul 2017 21:20:58 +0200 Subject: [PATCH] implemented 'delete_webhook' for room --- hypchat/restobject.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hypchat/restobject.py b/hypchat/restobject.py index c94d21b..7eabc60 100644 --- a/hypchat/restobject.py +++ b/hypchat/restobject.py @@ -5,6 +5,7 @@ import dateutil.parser import dateutil.tz import six +from hypchat.requests import HttpNotFound _urls_to_objects = {} @@ -206,6 +207,17 @@ def invite(self, user, reason): 'reason': reason, }) + def delete_webhook(self, id): + """ + Deletes a given webhook: + https://www.hipchat.com/docs/apiv2/method/delete_webhook + """ + try: + self._requests.delete(self.url + '/webhook/' + str(id)) + except HttpNotFound: + return False + return True + def create_webhook(self, url, event, pattern=None, name=None): """ Creates a new webhook.