Skip to content

Commit

Permalink
Merge pull request #114 from anthonyeden/memberCardsAndNotifications
Browse files Browse the repository at this point in the history
Members: Add "fetch_cards" and "fetch_notifications" methods.
  • Loading branch information
sarumont committed Nov 10, 2015
2 parents ee73f89 + f81227c commit 083c7bf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions trello/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ def fetch_comments(self):
return sorted(comments, key=lambda comment: comment['date'])
return []

def fetch_cards(self):
""" Fetches all the cards for this member """
cards = self.client.fetch_json(
'/members/' + self.id + '/cards',
query_params={'filter': 'visible'})
return sorted(cards, key=lambda card: card['dateLastActivity'])

def fetch_notifications(self, filters = []):
""" Fetches all the notifications for this member """
notifications = self.client.fetch_json(
'/members/' + self.id + '/notifications',
query_params={'filter': ",".join(filters)})
return sorted(notifications, key=lambda notification: notification['date'])

@classmethod
def from_json(cls, trello_client, json_obj):
"""
Expand Down

0 comments on commit 083c7bf

Please sign in to comment.