Skip to content

Commit

Permalink
Rename API.destroy_direct_message to API.delete_direct_message
Browse files Browse the repository at this point in the history
Rename DirectMessage.destroy to DirectMessage.delete
  • Loading branch information
Harmon758 committed May 28, 2021
1 parent ff1186f commit 2731fc9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/api.rst
Expand Up @@ -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` |
+------------------------------------------+-------------------------------------+
Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions tests/test_api.py
Expand Up @@ -135,8 +135,8 @@ def testsearchusers(self):
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
Expand All @@ -146,7 +146,7 @@ def testsendanddestroydirectmessage(self):
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):
Expand Down
4 changes: 2 additions & 2 deletions tweepy/api.py
Expand Up @@ -3153,8 +3153,8 @@ def report_spam(self, **kwargs):

# 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
Expand Down
4 changes: 2 additions & 2 deletions tweepy/models.py
Expand Up @@ -140,8 +140,8 @@ def parse_list(cls, api, json_list):
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):
Expand Down

0 comments on commit 2731fc9

Please sign in to comment.