Skip to content

Commit

Permalink
Merge pull request #219 from plivo/SMS-4914-sdk-for-delete-campaign-b…
Browse files Browse the repository at this point in the history
…rand-api

Delete Campaign - Brand Request - Python SDK
  • Loading branch information
renoldthomas-plivo authored Dec 15, 2022
2 parents 6bb6c25 + aa6ec20 commit c8ff052
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Change Log
## [4.29.0](https://github.com/plivo/plivo-python/tree/v4.29.0) (2022-12-06)
**Adding Delete campaign and brand**
-Added delete campaign and brand

## [4.28.0](https://github.com/plivo/plivo-python/tree/v4.28.0) (2022-11-03)
**Adding Brand Usecase request**
-Added Brand Usecase request
Expand Down
5 changes: 5 additions & 0 deletions plivo/resources/brand.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ def create(self,
def get_usecases(self, brand_id):
return self.client.request(
'GET', ('10dlc','Brand', brand_id, 'usecases'), response_type=None)

@validate_args(brand_id=[required(of_type(six.text_type))])
def delete(self, brand_id):
return self.client.request(
'DELETE', ('10dlc','Brand', brand_id), response_type=None)
5 changes: 5 additions & 0 deletions plivo/resources/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def get(self, campaign_id):
return self.client.request(
'GET', ('10dlc','Campaign', campaign_id), response_type=None)

@validate_args(campaign_id=[required(of_type(six.text_type))])
def delete(self, campaign_id):
return self.client.request(
'DELETE', ('10dlc','Campaign', campaign_id), response_type=None)

@validate_args(
brand=[optional(of_type(six.text_type))],
usecase=[optional(of_type(six.text_type))],
Expand Down
2 changes: 1 addition & 1 deletion plivo/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '4.28.0'
__version__ = '4.29.0'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='plivo',
version='4.28.0',
version='4.29.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',
Expand Down
4 changes: 4 additions & 0 deletions tests/resources/fixtures/brandDeleteResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "Brand Deactivated",
"brand_id": "BRPXS6E"
}
4 changes: 4 additions & 0 deletions tests/resources/fixtures/campaignDeleteResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "Campaign Deactivated",
"campaign_id": "CUU5RCB"
}
15 changes: 14 additions & 1 deletion tests/resources/test_brand.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,17 @@ def test_get_usecases(self):
self.client.current_request.url)

# Verifying the method used
self.assertEqual('GET', self.client.current_request.method)
self.assertEqual('GET', self.client.current_request.method)

@with_response(200)
def test_delete(self):
response = self.client.brand.delete(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/',
self.client.current_request.url)

# Verifying the method used
self.assertEqual('DELETE', self.client.current_request.method)
11 changes: 11 additions & 0 deletions tests/resources/test_campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ def test_get(self):

# Verifying the method used
self.assertEqual('GET', self.client.current_request.method)

@with_response(200)
def test_delete(self):
response = self.client.campaign.delete(campaign_id='CUU5RCB')
# Verifying the endpoint hit
self.assertUrlEqual(
'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/CUU5RCB/',
self.client.current_request.url)

# Verifying the method used
self.assertEqual('DELETE', self.client.current_request.method)

@with_response(200)
def test_list(self):
Expand Down

0 comments on commit c8ff052

Please sign in to comment.