Skip to content

Commit

Permalink
Merge pull request #64 from guillermo-carrasco/master
Browse files Browse the repository at this point in the history
Add method get_card, fixes #62
  • Loading branch information
sarumont committed Oct 14, 2014
2 parents 2371296 + 9ec5b03 commit 32ec635
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions trello/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 32ec635

Please sign in to comment.