Commits

Jason R. Coombs committed 45dc651

Added delete support for cards.

  • Participants
  • Parent commits d1e0dc6

Comments (0)

Files changed (1)

File trollop/lib.py

     def put(self, path, params=None, body=None):
         return self.request('PUT', path, params, body)
 
+    def delete(self, path, params=None, body=None):
+        return self.request('DELETE', path, params, body)
+
     def get_board(self, board_id):
         return Board(self, board_id)
 
         result = self._conn.put(path, params=params)
 
 
+class Deletable(object):
+    """
+    Mixin for Trello objects which are allowed to be DELETEd.
+    """
+    def delete(self):
+        path = self._prefix + self._id
+        self._conn.delete(path)
+
+
 class Field(object):
     """
     A simple field on a Trello object.  Maps the attribute to a key in the
     members = SubList('Member')
 
 
-class Card(LazyTrello, Closable):
+class Card(LazyTrello, Closable, Deletable):
 
     _prefix = '/cards/'
 
     # could one checklist belong to multiple cards?
 
 class CheckItem(LazyTrello):
-    
+
     _prefix = '/checkItems/'
 
     name = Field()