From 60ec027a52ed55cc2980fd2c190b237abd85e402 Mon Sep 17 00:00:00 2001 From: Aleksandr Alekseev Date: Mon, 21 Jan 2019 16:37:52 +0300 Subject: [PATCH 1/3] pep8 fixes --- supportbee/__init__.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/supportbee/__init__.py b/supportbee/__init__.py index c2f101a..e750b6f 100644 --- a/supportbee/__init__.py +++ b/supportbee/__init__.py @@ -1,10 +1,13 @@ # -*- coding: utf-8 -*- +import json + +import requests + from supportbee.exceptions import ValidationFailureException, \ UnAuthorizedException, AccessDeniedException, ClientException, \ ServerFailureException, ServerException, SupportBeeException -import requests -import json + class SupportBee(object): BASE_URL = "https://%s.supportbee.com" @@ -80,7 +83,6 @@ def archive_ticket(self, ticket_id): """ return self._request('/tickets/%s/archive.json' % (ticket_id), method='POST') - def unarchive_ticket(self, ticket_id): """ Unarchives the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -106,7 +108,6 @@ def star_ticket(self, ticket_id): """ return self._request('/tickets/%s/star.json' % (ticket_id), method='POST') - def unstar_ticket(self, ticket_id): """ Unstars the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -115,7 +116,6 @@ def unstar_ticket(self, ticket_id): """ return self._request('/tickets/%s/star.json' % (ticket_id), method='DELETE') - def spam_ticket(self, ticket_id): """ Spams the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -124,7 +124,6 @@ def spam_ticket(self, ticket_id): """ return self._request('/tickets/%s/spam.json' % (ticket_id), method='POST') - def unspam_ticket(self, ticket_id): """ Un-spam the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -133,7 +132,6 @@ def unspam_ticket(self, ticket_id): """ return self._request('/tickets/%s/spam.json' % (ticket_id), method='DELETE') - def trash_ticket(self, ticket_id): """ Trashes the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -142,7 +140,6 @@ def trash_ticket(self, ticket_id): """ return self._request('/tickets/%s/trash.json' % (ticket_id), method='POST') - def untrash_ticket(self, ticket_id): """ Un-trashes the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions From 6865d2f567bca79155d08497edda74b2582fa53f Mon Sep 17 00:00:00 2001 From: Aleksandr Alekseev Date: Mon, 21 Jan 2019 16:41:20 +0300 Subject: [PATCH 2/3] update .gitignore --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d3a841a..7586c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ .settings/ .project .pydevproject - - +.idea/ From f27efbeeed6900d647b651e95b99a68e0afbab12 Mon Sep 17 00:00:00 2001 From: Aleksandr Alekseev Date: Mon, 21 Jan 2019 16:42:03 +0300 Subject: [PATCH 3/3] add label creation request --- supportbee/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/supportbee/__init__.py b/supportbee/__init__.py index e750b6f..ea53c5f 100644 --- a/supportbee/__init__.py +++ b/supportbee/__init__.py @@ -169,3 +169,12 @@ def show_reply(self, ticket_id, reply_id): """ return self._request('/tickets/%s/replies/%s.json' % (ticket_id, reply_id)) + def add_label_to_ticket(self, ticket_id, label): + """ + Adds the label to the ticket with id ticket_id. + Supported parameters are available at https://developers.supportbee.com/api#adding_label + Params + ticket_id: SuppportBee Ticket ID + label: label name to add + """ + return self._request('/tickets/%s/labels/%s' % (ticket_id, label), method='POST')