From ffe8a37bb86e4e285a8f42c93a327a8d6fbf3d72 Mon Sep 17 00:00:00 2001 From: maxkahan Date: Sat, 26 Aug 2023 03:50:42 +0100 Subject: [PATCH] removed Redact API support, added changelog entries for v4 release --- CHANGES.md | 13 ++++++++++++- src/vonage/client.py | 1 - src/vonage/errors.py | 5 ----- src/vonage/redact.py | 31 ------------------------------- tests/conftest.py | 5 ----- tests/test_redact.py | 36 ------------------------------------ 6 files changed, 12 insertions(+), 79 deletions(-) delete mode 100644 src/vonage/redact.py delete mode 100644 tests/test_redact.py diff --git a/CHANGES.md b/CHANGES.md index 28486b0b..efa33c29 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,14 @@ +# 4.0.0 +New features: +- Added support for the Vonage Video API +- Added error handling for APIs that return a 200 on failure + +Breaking changes: +- Removed redundant intermediary `Error` class +- Removed `Pay` action from NCCO builder +- Removed `Redact` class and support for the Redact API as it's a dev preview product that's unsupported in the SDK +- Removed `ApplicationV2` class. Use `Application` instead + # 3.9.0 - Dropped support for Python 3.7 as it's end-of-life and no longer receiving security updates @@ -83,7 +94,7 @@ Enhancements: - Added Messages API v1.0 support. Messages API can now be used by calling the `client.messages.send_message()` method. # 2.7.0 -- Moved some client methods into their own classes: `account.py, application.py, +- Moved some client methods into their own classes: `account.py, application.py, message_search.py, number_insight.py, numbers.py, short_codes.py, ussd.py` - Deprecated the corresponding client methods. These will be removed in a major release that's coming soon. - Client now instantiates a class object for each API when it is created, e.g. `vonage.Client(key="mykey", secret="mysecret")` diff --git a/src/vonage/client.py b/src/vonage/client.py index a59c1a0f..ed086429 100644 --- a/src/vonage/client.py +++ b/src/vonage/client.py @@ -9,7 +9,6 @@ from .number_insight import NumberInsight from .number_management import Numbers from .proactive_connect import ProactiveConnect -from .redact import Redact from .short_codes import ShortCodes from .sms import Sms from .subaccounts import Subaccounts diff --git a/src/vonage/errors.py b/src/vonage/errors.py index 839b406e..938ae49c 100644 --- a/src/vonage/errors.py +++ b/src/vonage/errors.py @@ -36,11 +36,6 @@ class PricingTypeError(ClientError): """A pricing type was specified that is not allowed.""" -class RedactError(ClientError): - - """Error related to the Redact class or Redact API.""" - - class InvalidAuthenticationTypeError(ClientError): """An authentication method was specified that is not allowed.""" diff --git a/src/vonage/redact.py b/src/vonage/redact.py deleted file mode 100644 index c1ec18f5..00000000 --- a/src/vonage/redact.py +++ /dev/null @@ -1,31 +0,0 @@ -from .errors import RedactError - -from deprecated import deprecated - - -@deprecated( - version='3.0.0', - reason='This is a dev preview product and as such is not supported in this SDK.', -) -class Redact: - auth_type = 'header' - - allowed_product_names = {'sms', 'voice', 'number-insight', 'verify', 'verify-sdk', 'messages'} - - def __init__(self, client): - self._client = client - - def redact_transaction(self, id: str, product: str, type=None): - self._check_allowed_product_name(product) - params = {"id": id, "product": product} - if type is not None: - params["type"] = type - return self._client.post( - self._client.api_host(), "/v1/redact/transaction", params, auth_type=Redact.auth_type - ) - - def _check_allowed_product_name(self, product): - if product not in self.allowed_product_names: - raise RedactError( - f'Invalid product name in redact request. Must be one of {self.allowed_product_names}.' - ) diff --git a/tests/conftest.py b/tests/conftest.py index f388f7e2..cdfadbbd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -97,11 +97,6 @@ def messages(client): return vonage.Messages(client) -@pytest.fixture -def redact(client): - return vonage.Redact(client) - - @pytest.fixture def application_v2(client): import vonage diff --git a/tests/test_redact.py b/tests/test_redact.py deleted file mode 100644 index 609e5d9e..00000000 --- a/tests/test_redact.py +++ /dev/null @@ -1,36 +0,0 @@ -from util import * -from vonage.errors import RedactError - - -def test_redact_invalid_product_name(redact): - with pytest.raises(RedactError): - redact.redact_transaction(id='not-a-real-id', product='fake-product') - - -@responses.activate -def test_redact_transaction(redact, dummy_data): - responses.add( - responses.POST, - "https://api.nexmo.com/v1/redact/transaction", - body=None, - status=204, - ) - - assert redact.redact_transaction(id="not-a-real-id", product="sms") is None - assert request_user_agent() == dummy_data.user_agent - assert request_content_type() == "application/json" - - -@responses.activate -def test_redact_transaction_with_type(redact, dummy_data): - responses.add( - responses.POST, - "https://api.nexmo.com/v1/redact/transaction", - body=None, - status=204, - ) - - assert redact.redact_transaction(id="some-id", product="sms", type="xyz") is None - assert request_user_agent() == dummy_data.user_agent - assert request_content_type() == "application/json" - assert b"xyz" in request_body()