From 8dc5978a21caf1867906b72c26bd80c38ed37b4a Mon Sep 17 00:00:00 2001 From: d-telnyx <68876596+d-telnyx@users.noreply.github.com> Date: Mon, 29 Mar 2021 18:04:25 -0400 Subject: [PATCH] v1.3.0 updates (#49) --- VERSION | 2 +- setup.py | 2 +- telnyx/__init__.py | 2 +- telnyx/api_resources/abstract/api_resource.py | 8 ++------ telnyx/api_resources/fax.py | 4 ++++ .../api_resources/phone_number_regulatory_requirement.py | 4 ++++ .../test_phone_number_regulatory_requirement.py | 4 +++- tox.ini | 1 - 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index 23aa839..f0bb29e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2 +1.3.0 diff --git a/setup.py b/setup.py index 7c8dbcb..4af97e8 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ def run_tests(self): setup( name="telnyx", - version="1.2.2", + version="1.3.0", description="Python bindings for the Telnyx API", long_description=long_description, long_description_content_type="text/markdown", diff --git a/telnyx/__init__.py b/telnyx/__init__.py index 9a9fc27..20a0e15 100644 --- a/telnyx/__init__.py +++ b/telnyx/__init__.py @@ -24,7 +24,7 @@ log = None -__version__ = "1.2.2" +__version__ = "1.3.0" # Sets some basic information about the running application that's sent along diff --git a/telnyx/api_resources/abstract/api_resource.py b/telnyx/api_resources/abstract/api_resource.py index d8deca6..5086e4a 100644 --- a/telnyx/api_resources/abstract/api_resource.py +++ b/telnyx/api_resources/abstract/api_resource.py @@ -41,12 +41,8 @@ def class_url(cls): ) # Namespaces are separated in object names with periods (.) and in URLs # with forward slashes (/), so replace the former with the latter. - if cls.OBJECT_NAME == "fax": - base = cls.OBJECT_NAME.replace(".", "/") - return "/v2/%ses" % (base,) - else: - base = cls.OBJECT_NAME.replace(".", "/") - return "/v2/%ss" % (base,) + base = cls.OBJECT_NAME.replace(".", "/") + return "/v2/%ss" % (base,) def instance_url(self): id = self.get("id") diff --git a/telnyx/api_resources/fax.py b/telnyx/api_resources/fax.py index 1d9e61a..9460a21 100644 --- a/telnyx/api_resources/fax.py +++ b/telnyx/api_resources/fax.py @@ -15,3 +15,7 @@ class Fax( UpdateableAPIResource, ): OBJECT_NAME = "fax" + + @classmethod + def class_url(cls): + return "/v2/faxes" diff --git a/telnyx/api_resources/phone_number_regulatory_requirement.py b/telnyx/api_resources/phone_number_regulatory_requirement.py index b5451ea..6a43008 100644 --- a/telnyx/api_resources/phone_number_regulatory_requirement.py +++ b/telnyx/api_resources/phone_number_regulatory_requirement.py @@ -12,3 +12,7 @@ def retrieve(cls, id, api_key=None, **params): raise error.InvalidRequestError( "%s does not support retrieve()" % cls.class_url() ) + + @classmethod + def class_url(cls): + return "/v2/phone_numbers_regulatory_requirements" diff --git a/tests/api_resources/test_phone_number_regulatory_requirement.py b/tests/api_resources/test_phone_number_regulatory_requirement.py index 10f82d4..8ca22a7 100644 --- a/tests/api_resources/test_phone_number_regulatory_requirement.py +++ b/tests/api_resources/test_phone_number_regulatory_requirement.py @@ -10,7 +10,9 @@ class TestPhoneNumberRegulatoryRequirement(object): def test_is_listable(self, request_mock): resources = telnyx.PhoneNumberRegulatoryRequirement.list() - request_mock.assert_requested("get", "/v2/phone_number_regulatory_requirements") + request_mock.assert_requested( + "get", "/v2/phone_numbers_regulatory_requirements" + ) assert isinstance(resources.data, list) assert isinstance(resources.data[0], telnyx.PhoneNumberRegulatoryRequirement) diff --git a/tox.ini b/tox.ini index 3062278..d8e3b82 100644 --- a/tox.ini +++ b/tox.ini @@ -21,7 +21,6 @@ commands = python setup.py test -a "{posargs:-n auto}" [testenv:fmt] description = run code formatting using black -basepython = python3.7 deps = black isort