diff --git a/trello/board.py b/trello/board.py index 709f7454..7a7b473e 100644 --- a/trello/board.py +++ b/trello/board.py @@ -4,6 +4,7 @@ from trello.card import Card from trello.trellolist import List from trello.label import Label +from dateutil import parser as dateparser class Board(object): @@ -55,6 +56,12 @@ def from_json(cls, trello_client=None, organization=None, json_obj=None): board.description = json_obj.get('desc', '').encode('utf-8') board.closed = json_obj['closed'] board.url = json_obj['url'] + + try: + board.date_last_activity = dateparser.parse(json_obj['dateLastActivity']) + except: + pass + return board def __repr__(self): diff --git a/trello/card.py b/trello/card.py index 2cd5bca1..827ef8a1 100644 --- a/trello/card.py +++ b/trello/card.py @@ -112,6 +112,7 @@ def from_json(cls, parent, json_obj): card.idLabels = json_obj['idLabels'] card.idList = json_obj['idList'] card.labels = Label.from_json_list(card.board, json_obj['labels']) + card.dateLastActivity = dateparser.parse(json_obj['dateLastActivity']) return card def __repr__(self): diff --git a/trello/trelloclient.py b/trello/trelloclient.py index 4ed66eee..43dd7142 100644 --- a/trello/trelloclient.py +++ b/trello/trelloclient.py @@ -66,7 +66,7 @@ def logout(self): # TODO: This function. raise NotImplementedError() - def list_boards(self): + def list_boards(self, board_filter="all"): """ Returns all boards for your Trello user @@ -81,7 +81,7 @@ def list_boards(self): - closed: Boolean representing whether this board is closed or not - url: URL to the board """ - json_obj = self.fetch_json('/members/me/boards') + json_obj = self.fetch_json('/members/me/boards/?filter=%s' % board_filter) return [Board.from_json(self, json_obj=obj) for obj in json_obj] def list_organizations(self):