diff --git a/tests/ip_messaging/test_channels.py b/tests/ip_messaging/test_channels.py index 9d23b8df3f..90720cdd3a 100644 --- a/tests/ip_messaging/test_channels.py +++ b/tests/ip_messaging/test_channels.py @@ -20,9 +20,10 @@ def test_create_channel(self, mock): mock.return_value = resp uri = "%s/Channels" % (BASE_URI) - list_resource.create(friendly_name='TestChannel') + list_resource.create(friendly_name='TestChannel', unique_name='Unique') exp_params = { - 'FriendlyName': "TestChannel" + 'FriendlyName': "TestChannel", + 'UniqueName': 'Unique' } mock.assert_called_with("POST", uri, data=exp_params, auth=AUTH, diff --git a/tests/ip_messaging/test_messages.py b/tests/ip_messaging/test_messages.py index 62f9d450d4..49b5778225 100644 --- a/tests/ip_messaging/test_messages.py +++ b/tests/ip_messaging/test_messages.py @@ -39,6 +39,21 @@ def test_get(self, mock): mock.assert_called_with("GET", uri, auth=AUTH, use_json_extension=False) + @patch("twilio.rest.resources.base.make_twilio_request") + def test_update(self, mock): + resp = create_mock_json("tests/resources/ip_messaging/message_instance.json") + mock.return_value = resp + + update_params = { + 'UniqueName': 'unique' + } + + uri = "%s/Messages/%s" % (BASE_URI, MESSAGE_SID) + list_resource.update(MESSAGE_SID, unique_name='unique') + + mock.assert_called_with("POST", uri, data=update_params, auth=AUTH, + use_json_extension=False) + @patch("twilio.rest.resources.base.Resource.request") def test_delete(self, req): """ Deleting a call should work """ diff --git a/tests/ip_messaging/test_users.py b/tests/ip_messaging/test_users.py index 5790134b10..7a92c15569 100644 --- a/tests/ip_messaging/test_users.py +++ b/tests/ip_messaging/test_users.py @@ -22,7 +22,7 @@ def test_create_user(self, mock): uri = "%s/Users" % (BASE_URI) list_resource.create('test_id') exp_params = { - 'Id': "test_id" + 'Identity': "test_id" } mock.assert_called_with("POST", uri, data=exp_params, auth=AUTH, diff --git a/tests/resources/ip_messaging/channel_instance.json b/tests/resources/ip_messaging/channel_instance.json index d713a5111b..938a62013a 100644 --- a/tests/resources/ip_messaging/channel_instance.json +++ b/tests/resources/ip_messaging/channel_instance.json @@ -3,6 +3,7 @@ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "friendly_name": "update", + "unique_name": "unique", "attributes": "", "date_created": "2015-08-20T09:30:24Z", "date_updated": "2015-08-20T09:30:24Z", diff --git a/twilio/rest/resources/ip_messaging/channels.py b/twilio/rest/resources/ip_messaging/channels.py index 8f84b2216d..b7e4f5529a 100644 --- a/twilio/rest/resources/ip_messaging/channels.py +++ b/twilio/rest/resources/ip_messaging/channels.py @@ -16,6 +16,7 @@ def update(self, **kwargs): :param sid: Channel instance identifier :param type: Channel type :param friendly_name: Channel's friendly name + :param unique_name: Channel's Unique name :param attributes: Additional attributes that needs to be stored with channel :return: the updated instance @@ -49,8 +50,9 @@ def create(self, **kwargs): """ Create a channel. - :param str friendly_name: The friendly name of the channel. - :param str attributes: An attribute string with arbitrary + :param str friendly_name: Channel's friendly name + :param unique_name: Channel's Unique name + :param str attributes: Developer-specific data (json) storage :return: A :class:`Channel` object """ @@ -68,6 +70,7 @@ def update(self, sid, **kwargs): :param sid: Channel instance identifier :param type: Channel type :param friendly_name: Channel's friendly name + :param unique_name: Channel's Unique name :param attributes: Additional attributes that needs to be stored with channel :return: Updated instance diff --git a/twilio/rest/resources/ip_messaging/messages.py b/twilio/rest/resources/ip_messaging/messages.py index 72452e130d..848ba16095 100644 --- a/twilio/rest/resources/ip_messaging/messages.py +++ b/twilio/rest/resources/ip_messaging/messages.py @@ -3,6 +3,17 @@ class Message(NextGenInstanceResource): + def update(self, **kwargs): + """ + Updates the Message instance + :param sid: Message instance identifier + :param service_sid: Service instance identifier + :param channel_sid: Channel instance identifier + :param body: Message's body + :return: the updated instance + """ + return self.update_instance(**kwargs) + def delete(self): """ Delete this message @@ -44,3 +55,14 @@ def delete(self, sid): Delete a given Message """ return self.delete_instance(sid) + + def update(self, sid, **kwargs): + """ + Updates the Message instance identified by sid + :param sid: Message instance identifier + :param service_sid: Service instance identifier + :param channel_sid: Channel instance identifier + :param body: Message's body + :return: the updated instance + """ + return self.update_instance(sid, kwargs) diff --git a/twilio/rest/resources/ip_messaging/users.py b/twilio/rest/resources/ip_messaging/users.py index b37e6767e5..1439772cc0 100644 --- a/twilio/rest/resources/ip_messaging/users.py +++ b/twilio/rest/resources/ip_messaging/users.py @@ -35,16 +35,16 @@ def list(self, **kwargs): """ return self.get_instances(kwargs) - def create(self, id, **kwargs): + def create(self, identity, **kwargs): """ Creates a User - :param str id: The identity of the user. + :param str identity: The identity of the user. :param str role_sid: The role to assign the user. :return: A :class:`User` object """ - kwargs["id"] = id + kwargs["identity"] = identity return self.create_instance(kwargs) def delete(self, sid):