Skip to content

Commit 1becc75

Browse files
author
marcel corso gonzalez
authored
Merge pull request #77 from surik/depricate-callflow-title
Deprecate CallFlow Title usage
2 parents 38fb287 + 9112149 commit 1becc75

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ MessageBird's REST API for Python
22
=================================
33
This repository contains the open source Python client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com/.
44

5+
Something random
6+
57
Requirements
68
------------
79
- [Sign up](https://www.messagebird.com/en/signup) for a free MessageBird account

examples/call_create.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
99
import messagebird
1010

11-
exampleCallFlow = '{"title":"Test Flow","steps":[{"action":"say","options":{"payload":"Hey, this is your first voice \
11+
exampleCallFlow = '{"steps":[{"action":"say","options":{"payload":"Hey, this is your first voice \
1212
call","language":"en-GB","voice":"female"}}]}'
1313

1414
parser = argparse.ArgumentParser(usage='call_create.py\

examples/call_flow.py

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# Print the object information.
2929
print('\nThe following information was returned as a CallFlow object:\n')
3030
print(' id : {}'.format(call.id))
31-
print(' title : {}'.format(call.title))
3231
print(' steps : ')
3332
for step in call.steps:
3433
print(step)

messagebird/client.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,16 @@ def call_flow_list(self, limit=10, offset=0):
504504
query = self._format_query(limit, offset)
505505
return CallFlowList().load(self.request('call-flows?' + query, 'GET', None, VOICE_TYPE))
506506

507-
def call_flow_create(self, title, steps, default=False, record=False):
508-
params = {'title': title, 'steps': steps, 'default': default, 'record': record}
507+
def call_flow_create(self, steps, default=False, record=False, title=None):
508+
params = {'steps': steps, 'default': default, 'record': record}
509+
if title is not None:
510+
params['title'] = title
509511
return CallFlow().load(self.request('call-flows', 'POST', params, VOICE_TYPE))
510512

511-
def call_flow_update(self, id, title, steps, default, record):
512-
params = {'title': title, 'steps': steps, 'default': default, 'record': record}
513+
def call_flow_update(self, id, steps, default, record, title=None):
514+
params = {'steps': steps, 'default': default, 'record': record}
515+
if title is not None:
516+
params['title'] = title
513517
return CallFlow().load(self.request('call-flows/' + str(id), 'PUT', params, VOICE_TYPE))
514518

515519
def call_flow_delete(self, id):

tests/test_call.py

-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ def test_call_create(self):
126126
"source": "31644556677",
127127
"destination": "31612345678",
128128
"callFlow": {
129-
"title": "Say message",
130129
"steps": [
131130
{
132131
"action": "say",

tests/test_call_flow.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def test_get_flow_list(self):
4545
"data": [
4646
{
4747
"id": "de3ed163-d5fc-45f4-b8c4-7eea7458c635",
48-
"title": "Forward call to 31612345678",
4948
"record": false,
5049
"steps": [
5150
{
@@ -64,7 +63,6 @@ def test_get_flow_list(self):
6463
},
6564
{
6665
"id": "de3ed163-d5fc-45f4-b8c4-7eea7458c634",
67-
"title": "Forward call to 0600123123",
6866
"record": true,
6967
"steps": [
7068
{
@@ -97,8 +95,9 @@ def test_get_flow_list(self):
9795
call_flow_list = Client('', http_client).call_flow_list(20, 0)
9896

9997
http_client.request.assert_called_once_with('call-flows?limit=20&offset=0', 'GET', None)
98+
self.assertEqual(call_flow_list.data[0].title, None)
99+
self.assertEqual(call_flow_list.data[1].title, None)
100100

101-
self.assertEqual('Forward call to 0600123123', call_flow_list.data[1].title)
102101
self.assertEqual(2, call_flow_list.pagination['totalCount'])
103102

104103
def test_numbers_list(self):

0 commit comments

Comments
 (0)