Skip to content

Commit

Permalink
Merge pull request #218 from plivo/SMS-4444-Brand-Usecase-Python
Browse files Browse the repository at this point in the history
Brand Usecase Python Request
  • Loading branch information
renoldthomas-plivo authored Nov 9, 2022
2 parents 25a2587 + 6e1b957 commit 6bb6c25
Show file tree
Hide file tree
Showing 6 changed files with 87 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.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)
Expand Down
8 changes: 7 additions & 1 deletion plivo/resources/brand.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ def create(self,
method='POST'
):
return self.client.request('POST', ('10dlc', 'Brand'),
to_param_dict(self.create, locals()))
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)
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.27.0'
__version__ = '4.28.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.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',
Expand Down
61 changes: 61 additions & 0 deletions tests/resources/fixtures/brandGetUsecasesResponse.json
Original file line number Diff line number Diff line change
@@ -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"
}
13 changes: 13 additions & 0 deletions tests/resources/test_brand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6bb6c25

Please sign in to comment.