From 2731fc98fc7298425d8208d0184a60418af02ca9 Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 28 May 2021 08:14:17 -0500 Subject: [PATCH] Rename API.destroy_direct_message to API.delete_direct_message Rename DirectMessage.destroy to DirectMessage.delete --- ...rectmessage.json => testsendanddeletedirectmessage.json} | 0 docs/api.rst | 4 ++-- tests/test_api.py | 6 +++--- tweepy/api.py | 4 ++-- tweepy/models.py | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) rename cassettes/{testsendanddestroydirectmessage.json => testsendanddeletedirectmessage.json} (100%) diff --git a/cassettes/testsendanddestroydirectmessage.json b/cassettes/testsendanddeletedirectmessage.json similarity index 100% rename from cassettes/testsendanddestroydirectmessage.json rename to cassettes/testsendanddeletedirectmessage.json diff --git a/docs/api.rst b/docs/api.rst index ec02bb1..40b890c 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -190,7 +190,7 @@ +------------------------------------------+-------------------------------------+ | .. centered:: |Sending and receiving events|_ | +------------------------------------------+-------------------------------------+ - | `DELETE direct_messages/events/destroy`_ | :meth:`API.destroy_direct_message` | + | `DELETE direct_messages/events/destroy`_ | :meth:`API.delete_direct_message` | +------------------------------------------+-------------------------------------+ | `GET direct_messages/events/list`_ | :meth:`API.get_direct_messages` | +------------------------------------------+-------------------------------------+ @@ -554,7 +554,7 @@ Direct Messages Sending and receiving events ---------------------------- -.. automethod:: API.destroy_direct_message +.. automethod:: API.delete_direct_message .. automethod:: API.get_direct_messages diff --git a/tests/test_api.py b/tests/test_api.py index 76c5faf..066a2e6 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -135,8 +135,8 @@ class TweepyAPITests(TweepyTestCase): def testgetdirectmessages(self): self.api.get_direct_messages() - @tape.use_cassette('testsendanddestroydirectmessage.json') - def testsendanddestroydirectmessage(self): + @tape.use_cassette('testsendanddeletedirectmessage.json') + def testsendanddeletedirectmessage(self): me = self.api.verify_credentials() # send @@ -146,7 +146,7 @@ class TweepyAPITests(TweepyTestCase): self.assertEqual(int(sent_dm.message_create['target']['recipient_id']), me.id) # destroy - self.api.destroy_direct_message(sent_dm.id) + self.api.delete_direct_message(sent_dm.id) @tape.use_cassette('testcreatedestroyfriendship.yaml', serializer='yaml') def testcreatedestroyfriendship(self): diff --git a/tweepy/api.py b/tweepy/api.py index 377688e..43ea110 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -3153,8 +3153,8 @@ class API: # Sending and receiving events - def destroy_direct_message(self, id, **kwargs): - """destroy_direct_message(id) + def delete_direct_message(self, id, **kwargs): + """delete_direct_message(id) Deletes the direct message specified in the required ID parameter. The authenticating user must be the recipient of the specified direct diff --git a/tweepy/models.py b/tweepy/models.py index b9f1f3d..3c1fd10 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -140,8 +140,8 @@ class DirectMessage(Model): results.append(cls.parse(api, obj)) return results - def destroy(self): - return self._api.destroy_direct_message(self.id) + def delete(self): + return self._api.delete_direct_message(self.id) class Friendship(Model): -- 2.25.1