From 9ec5b03d534a6dd022f1c33bc585721e535c534c Mon Sep 17 00:00:00 2001 From: Guillermo Carrasco Date: Wed, 8 Oct 2014 10:24:53 +0200 Subject: [PATCH] Add method get_card, fixes #62 --- trello/__init__.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/trello/__init__.py b/trello/__init__.py index aeabf93a..786b7463 100644 --- a/trello/__init__.py +++ b/trello/__init__.py @@ -99,6 +99,12 @@ def add_board(self, board_name): def get_member(self, member_id): return Member(self, member_id).fetch() + def get_card(self, card_id): + card_json = self.fetch_json('/cards/' + card_id) + list_json = self.fetch_json('/lists/' + card_json['idList']) + board = self.get_board(card_json['idBoard']) + return Card.from_json(List.from_json(board, list_json), card_json) + def fetch_json( self, uri_path, @@ -776,15 +782,15 @@ def rename_checklist_item(self, name, new_name): [ix] = [i for i in range(len(self.items)) if self.items[i]['name'] == name] except ValueError: return - + json_obj = self.client.fetch_json( '/cards/'+self.trello_card+\ '/checklist/'+self.id+\ '/checkItem/'+self.items[ix]['id'], http_method = 'PUT', post_args = {'name' : new_name}) - - self.items[ix] = json_obj + + self.items[ix] = json_obj return json_obj def __repr__(self):