From bd7e2022a3defa8b62ae16de065c151a97fc7cf1 Mon Sep 17 00:00:00 2001 From: Alireza Savand Date: Sat, 19 Jul 2014 18:15:07 +0400 Subject: [PATCH 1/4] Add Webhooks resource module --- bigcommerce/resources/webhooks.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 bigcommerce/resources/webhooks.py diff --git a/bigcommerce/resources/webhooks.py b/bigcommerce/resources/webhooks.py new file mode 100644 index 0000000..c995e10 --- /dev/null +++ b/bigcommerce/resources/webhooks.py @@ -0,0 +1,6 @@ +from .base import * + + +class Webhooks(ListableApiResource, CreateableApiResource, + UpdateableApiResource, DeleteableApiResource): + resource_name = 'webhooks' From dc5e3562f3bface45f995ff1526898e0ced07f90 Mon Sep 17 00:00:00 2001 From: Alireza Savand Date: Sat, 19 Jul 2014 18:20:06 +0400 Subject: [PATCH 2/4] Import webhooks module into resources module --- bigcommerce/resources/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bigcommerce/resources/__init__.py b/bigcommerce/resources/__init__.py index 587c69b..dd4141e 100644 --- a/bigcommerce/resources/__init__.py +++ b/bigcommerce/resources/__init__.py @@ -14,4 +14,5 @@ from .shipping import * from .store import * from .tax_classes import * -from .time import * \ No newline at end of file +from .time import * +from .webhooks import * From 058d9a5c9396522d60cf595820cf94a67b42c475 Mon Sep 17 00:00:00 2001 From: Alireza Savand Date: Sun, 17 Aug 2014 21:00:30 +0400 Subject: [PATCH 3/4] Fix typo in resource name --- bigcommerce/resources/webhooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigcommerce/resources/webhooks.py b/bigcommerce/resources/webhooks.py index c995e10..a8e5137 100644 --- a/bigcommerce/resources/webhooks.py +++ b/bigcommerce/resources/webhooks.py @@ -3,4 +3,4 @@ class Webhooks(ListableApiResource, CreateableApiResource, UpdateableApiResource, DeleteableApiResource): - resource_name = 'webhooks' + resource_name = 'hooks' From 6e4e2e09bc558b5529900a3031ceda383a05bce4 Mon Sep 17 00:00:00 2001 From: Douglas Anderson Date: Tue, 27 Jan 2015 09:42:46 -0500 Subject: [PATCH 4/4] Overrode the delete_all method on Webhooks. --- bigcommerce/resources/webhooks.py | 4 ++++ tests/test_base.py | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bigcommerce/resources/webhooks.py b/bigcommerce/resources/webhooks.py index a8e5137..f932668 100644 --- a/bigcommerce/resources/webhooks.py +++ b/bigcommerce/resources/webhooks.py @@ -4,3 +4,7 @@ class Webhooks(ListableApiResource, CreateableApiResource, UpdateableApiResource, DeleteableApiResource): resource_name = 'hooks' + + @classmethod + def delete_all(self, connection=None): + raise NotImplementedError("The webhook resource does not have delete_all endpoint") diff --git a/tests/test_base.py b/tests/test_base.py index b67c62d..b9a14e0 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -1,6 +1,7 @@ import unittest from bigcommerce.resources import Mapping, Orders, ApiResource, OrderShipments from bigcommerce.resources.orders import OrderCoupons +from bigcommerce.resources.webhooks import Webhooks from mock import MagicMock @@ -167,4 +168,10 @@ def test_delete(self): shipment = OrderShipments({'id': 1, 'order_id': 2, '_connection': connection}) self.assertEqual(shipment.delete(), {}) - connection.make_request.assert_called_once_with('DELETE', 'orders/2/shipments/1', None, {}, {}) \ No newline at end of file + connection.make_request.assert_called_once_with('DELETE', 'orders/2/shipments/1', None, {}, {}) + + def test_webhook_delete_all(self): + connection = MagicMock() + connection.make_request.return_value = {} + + self.assertRaises(NotImplementedError, Webhooks.delete_all, connection=connection)