From 3069d90537cd04b2891089e4f4e0d50346dc9dc5 Mon Sep 17 00:00:00 2001 From: NirmitiJain Date: Fri, 4 Nov 2022 10:57:36 +0530 Subject: [PATCH 1/2] Brand Usecase Python Request --- CHANGELOG.md | 4 ++ plivo/resources/brand.py | 8 ++- plivo/version.py | 2 +- .../fixtures/brandGetUsecasesResponse.json | 61 +++++++++++++++++++ tests/resources/test_brand.py | 13 ++++ 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 tests/resources/fixtures/brandGetUsecasesResponse.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 525b3dc2..df01f804 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Change Log +## [4.28.0](https://github.com/plivo/plivo-python/tree/v4.28.0) (2022-11-03) +**Adding Brand Usecase request** +-Added Brand Usecase request + ## [4.27.0](https://github.com/plivo/plivo-python/tree/v4.27.0) (2022-10-14) **Adding new attributes to Account PhoneNumber object** -Added 3 new keys to AccountPhoneNumber object:`tendlc_registration_status`, `tendlc_campaign_id` and `toll_free_sms_verification` (https://www.plivo.com/docs/numbers/api/account-phone-number#the-accountphonenumber-object) diff --git a/plivo/resources/brand.py b/plivo/resources/brand.py index 9b8eb65b..99236bb8 100644 --- a/plivo/resources/brand.py +++ b/plivo/resources/brand.py @@ -51,4 +51,10 @@ def create(self, method='POST' ): return self.client.request('POST', ('10dlc', 'Brand'), - to_param_dict(self.create, locals())) \ No newline at end of file + to_param_dict(self.create, locals())) + + + @validate_args(brand_id=[required(of_type(six.text_type))]) + def get_usecases(self, brand_id): + return self.client.request( + 'GET', ('10dlc','Brand', brand_id, 'usecases'), response_type=None) diff --git a/plivo/version.py b/plivo/version.py index 0389698b..5f2ef79e 100644 --- a/plivo/version.py +++ b/plivo/version.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -__version__ = '4.27.0' +__version__ = '4.28.0' diff --git a/tests/resources/fixtures/brandGetUsecasesResponse.json b/tests/resources/fixtures/brandGetUsecasesResponse.json new file mode 100644 index 00000000..f332c219 --- /dev/null +++ b/tests/resources/fixtures/brandGetUsecasesResponse.json @@ -0,0 +1,61 @@ +{ + "use_cases": [ + { + "name": "Account Notification", + "code": "ACCOUNT_NOTIFICATION", + "details": "Notification sent to account holders about changes in accounts" + }, + { + "name": "Customer Care", + "code": "CUSTOMER_CARE", + "details": "Customer care interactions by the support and other customer-facing teams" + }, + { + "name": "Delivery Notification", + "code": "DELIVERY_NOTIFICATION", + "details": "Updates about the delivery of products and services" + }, + { + "name": "Fraud Alert", + "code": "FRAUD_ALERT", + "details": "Notifications of suspicious behavior identified the business" + }, + { + "name": "Higher Education", + "code": "HIGHER_EDUCATION", + "details": "Messages sent by colleges, universities, and other educational institutions" + }, + { + "name": "Low Volume", + "code": "LOW_VOLUME", + "details": "A combination of two to five standard usage cases - for low throughput requirements" + }, + { + "name": "Marketing", + "code": "MARKETING", + "details": "Communications related to time-bound events and sales" + }, + { + "name": "Mixed", + "code": "MIXED", + "details": "A combination of two to five standard usage cases" + }, + { + "name": "Polling Voting", + "code": "POLLING_VOTING", + "details": "Surveys, polling, and voting campaigns used for non-political purposes" + }, + { + "name": "Public Service Announcement", + "code": "PUBLIC_SERVICE_ANNOUNCEMENT", + "details": "Messages aimed at creating awareness about important topics" + }, + { + "name": "Security Alert", + "code": "SECURITY_ALERT", + "details": "Notifications that alert users about a potential breach of systems" + } + ], + "brand_id": "BRPXS6E", + "api_id": "e1474046-0723-11ed-ab02-0242ac110004" +} diff --git a/tests/resources/test_brand.py b/tests/resources/test_brand.py index cb739c71..a2f305ae 100644 --- a/tests/resources/test_brand.py +++ b/tests/resources/test_brand.py @@ -40,4 +40,17 @@ def test_list(self): 'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Brand/?limit=2&offset=0', self.client.current_request.url) # Verifying the method used + self.assertEqual('GET', self.client.current_request.method) + + @with_response(200) + def test_get_usecases(self): + response = self.client.brand.get_usecases(brand_id='BRPXS6E') + self.client.set_expected_response( + status_code=202, data_to_return=response) + # Verifying the endpoint hit + self.assertUrlEqual( + 'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Brand/BRPXS6E/usecases/', + self.client.current_request.url) + + # Verifying the method used self.assertEqual('GET', self.client.current_request.method) \ No newline at end of file From 6e1b957453e3ed5a66cdf4bf18d978403a060957 Mon Sep 17 00:00:00 2001 From: NirmitiJain Date: Wed, 9 Nov 2022 15:09:20 +0530 Subject: [PATCH 2/2] setup version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e1add1f4..3f7975fe 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='plivo', - version='4.27.0', + version='4.28.0', description='A Python SDK to make voice calls & send SMS using Plivo and to generate Plivo XML', long_description=long_description, url='https://github.com/plivo/plivo-python',