From c7a79918db55ddb381401d6f36e9079ce470d15c Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 12 Sep 2022 10:50:49 +0530 Subject: [PATCH 1/7] adding more attributes to campaign request --- CHANGELOG.md | 4 ++++ plivo/resources/campaign.py | 16 +++++++++++++++- plivo/version.py | 2 +- setup.py | 2 +- tests/resources/test_campaign.py | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e6c769f..4b40c42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Change Log +## [4.26.1](https://github.com/plivo/plivo-python/tree/v4.26.1) (2022-09-12) +**10DLC: Adding more attributes to campaign creation request** +- Adding more attributes to campaign creation request + ## [4.26.0](https://github.com/plivo/plivo-python/tree/v4.26.0) (2022-08-30) **Feature - 10DLC APIs** - Added new 10DLC APIs diff --git a/plivo/resources/campaign.py b/plivo/resources/campaign.py index 733227ec..5c6460cd 100644 --- a/plivo/resources/campaign.py +++ b/plivo/resources/campaign.py @@ -59,6 +59,13 @@ def list(self, brand=None, usecase=None, sample3=[optional(of_type(six.text_type))], sample4=[optional(of_type(six.text_type))], sample5=[optional(of_type(six.text_type))], + message_flow=[optional(of_type(six.text_type))] + help_message=[optional(of_type(six.text_type))] + optin_keywords=[optional(of_type(six.text_type))] + optin_message=[optional(of_type(six.text_type))] + optout_keywords=[optional(of_type(six.text_type))] + optout_message=[optional(of_type(six.text_type))] + help_keywords=[optional(of_type(six.text_type))] url=[optional(of_type(six.text_type))], method=[optional(of_type(six.text_type))]) def create(self, @@ -82,7 +89,14 @@ def create(self, subscriber_help=False, affiliate_marketing=False, campaign_alias=None, - sub_usecases=[]): + sub_usecases=[], + message_flow='', + help_message='', + optin_keywords='', + optin_message='', + optout_keywords='', + optout_message='', + help_keywords=''): return self.client.request('POST', ('10dlc', 'Campaign'), to_param_dict(self.create, locals())) diff --git a/plivo/version.py b/plivo/version.py index e97f07fe..78337876 100644 --- a/plivo/version.py +++ b/plivo/version.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -__version__ = '4.26.0' +__version__ = '4.26.1' diff --git a/setup.py b/setup.py index 032a3209..9658e659 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='plivo', - version='4.26.0', + version='4.26.1', 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', diff --git a/tests/resources/test_campaign.py b/tests/resources/test_campaign.py index 330f6d97..0a2c3df2 100644 --- a/tests/resources/test_campaign.py +++ b/tests/resources/test_campaign.py @@ -32,6 +32,38 @@ def test_create(self): 'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/', self.client.current_request.url) + @with_response(200) + def test_create_mandatory_param(self): + sub_usecase = ["CUSTOMER_CARE","2FA"] + response = self.client.campaign.create(brand_id = "B8OD95Z", + campaign_alias = "campaign name sssample", + vertical = "INSURANCE", + usecase = "MIXED", + sub_usecases = sub_usecase, + description = " description should be minimum 40 character description should be minimum 40 character", + embedded_link = False, + embedded_phone = False, + age_gated = False, + direct_lending = False, + subscriber_optin = True, + subscriber_optout = True, + subscriber_help = True, + affiliate_marketing = False, + sample1 = "sample message should be minimum 20 character", + sample2 = "sample message should be minimum 20 character", + sample3 = "test 1", + sample4 = "test 2", + sample5 = "test 2", + url="http://example.com/test", + method="POST", + message_flow="message flow is mandatory field with 40 minimum character length,message flow is mandatory field with 40 minimum character length", + help_message="help messgae is mandatory param and minimum 20 character", + optout_message="optout message should be mandatory and 20 minimum character") + self.assertEqual('POST', self.client.current_request.method) + self.assertUrlEqual( + 'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/', + self.client.current_request.url) + @with_response(200) def test_get(self): response = self.client.campaign.get(campaign_id='BRPXS6E') From bcd260fb5540dba4429ee3dcd528b427c798e18a Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 12 Sep 2022 10:57:00 +0530 Subject: [PATCH 2/7] typo fix --- plivo/resources/campaign.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plivo/resources/campaign.py b/plivo/resources/campaign.py index 5c6460cd..78ce2a1b 100644 --- a/plivo/resources/campaign.py +++ b/plivo/resources/campaign.py @@ -59,13 +59,13 @@ def list(self, brand=None, usecase=None, sample3=[optional(of_type(six.text_type))], sample4=[optional(of_type(six.text_type))], sample5=[optional(of_type(six.text_type))], - message_flow=[optional(of_type(six.text_type))] - help_message=[optional(of_type(six.text_type))] - optin_keywords=[optional(of_type(six.text_type))] - optin_message=[optional(of_type(six.text_type))] - optout_keywords=[optional(of_type(six.text_type))] - optout_message=[optional(of_type(six.text_type))] - help_keywords=[optional(of_type(six.text_type))] + message_flow=[optional(of_type(six.text_type))], + help_message=[optional(of_type(six.text_type))], + optin_keywords=[optional(of_type(six.text_type))], + optin_message=[optional(of_type(six.text_type))], + optout_keywords=[optional(of_type(six.text_type))], + optout_message=[optional(of_type(six.text_type))], + help_keywords=[optional(of_type(six.text_type))], url=[optional(of_type(six.text_type))], method=[optional(of_type(six.text_type))]) def create(self, From 1d60604ee48542631c71faa264d6095d76da72cf Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 12 Sep 2022 11:22:05 +0530 Subject: [PATCH 3/7] test fix --- tests/resources/test_campaign.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/resources/test_campaign.py b/tests/resources/test_campaign.py index 0a2c3df2..23cfd2c3 100644 --- a/tests/resources/test_campaign.py +++ b/tests/resources/test_campaign.py @@ -54,11 +54,15 @@ def test_create_mandatory_param(self): sample3 = "test 1", sample4 = "test 2", sample5 = "test 2", - url="http://example.com/test", - method="POST", - message_flow="message flow is mandatory field with 40 minimum character length,message flow is mandatory field with 40 minimum character length", - help_message="help messgae is mandatory param and minimum 20 character", - optout_message="optout message should be mandatory and 20 minimum character") + url = "http://example.com/test", + method = "POST", + message_flow = "message flow is mandatory field with 40 minimum character length,message flow is mandatory field with 40 minimum character length", + help_message = "help messgae is mandatory param and minimum 20 character", + optin_keywords= '', + optin_message ='', + optout_keywords = '', + optout_message = "optout message should be mandatory and 20 minimum character", + help_keywords='') self.assertEqual('POST', self.client.current_request.method) self.assertUrlEqual( 'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/', From 2a0ae948fb216e088e0a8d39f8dc06b7bc92addf Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 12 Sep 2022 11:25:36 +0530 Subject: [PATCH 4/7] ut fix --- plivo/resources/campaign.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plivo/resources/campaign.py b/plivo/resources/campaign.py index 78ce2a1b..fab2822d 100644 --- a/plivo/resources/campaign.py +++ b/plivo/resources/campaign.py @@ -79,6 +79,13 @@ def create(self, sample4='', sample5='', url='', + message_flow='', + help_message='', + optin_keywords='', + optin_message='', + optout_keywords='', + optout_message='', + help_keywords='', method='POST', embedded_link=False, embedded_phone=False, @@ -89,14 +96,7 @@ def create(self, subscriber_help=False, affiliate_marketing=False, campaign_alias=None, - sub_usecases=[], - message_flow='', - help_message='', - optin_keywords='', - optin_message='', - optout_keywords='', - optout_message='', - help_keywords=''): + sub_usecases=[]): return self.client.request('POST', ('10dlc', 'Campaign'), to_param_dict(self.create, locals())) From 1617d8b89891bcafa11d8453cfaacdc8920781e2 Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 12 Sep 2022 13:15:38 +0530 Subject: [PATCH 5/7] ut fix --- tests/resources/test_campaign.py | 37 ++++---------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/tests/resources/test_campaign.py b/tests/resources/test_campaign.py index 23cfd2c3..075dbca9 100644 --- a/tests/resources/test_campaign.py +++ b/tests/resources/test_campaign.py @@ -11,7 +11,7 @@ def test_create(self): vertical = "INSURANCE", usecase = "MIXED", sub_usecases = sub_usecase, - description = "sample description text", + description = "sample description is mandatory param and minimum 40 character,sample description is mandatory param and minimum 40 character", embedded_link = False, embedded_phone = False, age_gated = False, @@ -20,42 +20,13 @@ def test_create(self): subscriber_optout = True, subscriber_help = True, affiliate_marketing = False, - sample1 = "test 1", - sample2 = "test 2", + sample1 = "sample messgae 1 is mandatory param and minimum 20 character", + sample2 = "sample messgae 2 is mandatory param and minimum 20 character", sample3 = "test 1", sample4 = "test 2", sample5 = "test 2", url="http://example.com/test", - method="POST") - self.assertEqual('POST', self.client.current_request.method) - self.assertUrlEqual( - 'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/', - self.client.current_request.url) - - @with_response(200) - def test_create_mandatory_param(self): - sub_usecase = ["CUSTOMER_CARE","2FA"] - response = self.client.campaign.create(brand_id = "B8OD95Z", - campaign_alias = "campaign name sssample", - vertical = "INSURANCE", - usecase = "MIXED", - sub_usecases = sub_usecase, - description = " description should be minimum 40 character description should be minimum 40 character", - embedded_link = False, - embedded_phone = False, - age_gated = False, - direct_lending = False, - subscriber_optin = True, - subscriber_optout = True, - subscriber_help = True, - affiliate_marketing = False, - sample1 = "sample message should be minimum 20 character", - sample2 = "sample message should be minimum 20 character", - sample3 = "test 1", - sample4 = "test 2", - sample5 = "test 2", - url = "http://example.com/test", - method = "POST", + method="POST", message_flow = "message flow is mandatory field with 40 minimum character length,message flow is mandatory field with 40 minimum character length", help_message = "help messgae is mandatory param and minimum 20 character", optin_keywords= '', From 73c1512ebd640698aa29447a3660e748895efa39 Mon Sep 17 00:00:00 2001 From: Narayana Shanbhog Date: Wed, 28 Sep 2022 20:20:23 +0530 Subject: [PATCH 6/7] date update --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b40c42f..0a2e6aad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Change Log -## [4.26.1](https://github.com/plivo/plivo-python/tree/v4.26.1) (2022-09-12) +## [4.26.1](https://github.com/plivo/plivo-python/tree/v4.26.1) (2022-09-28) **10DLC: Adding more attributes to campaign creation request** - Adding more attributes to campaign creation request From 2a665d30665f18490ade0463aee4fa95a5c50a29 Mon Sep 17 00:00:00 2001 From: narayana Date: Wed, 28 Sep 2022 20:25:07 +0530 Subject: [PATCH 7/7] version upgrade --- plivo/version.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plivo/version.py b/plivo/version.py index 78337876..999bdac2 100644 --- a/plivo/version.py +++ b/plivo/version.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -__version__ = '4.26.1' +__version__ = '4.26.2' diff --git a/setup.py b/setup.py index 9658e659..6d123309 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='plivo', - version='4.26.1', + version='4.26.2', 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',