jeremytregunna/ruby-trello

Add Card Voting to Gem

brycemcd opened this issue ยท 8 comments

On trello, a user can upvote a card ( API definition ) . This functionality appears to be missing from this gem.

In a hobby project I work on, I wound up implementing the functionality and it was pretty straightforward for my use case.

Would there be any interest to include official support for voting in this gem? I'd be happy to contribute a pull request if there is interest.

@brycemcd sure please, as long as it is standard from Trello.

Great. It is a standard feature.

It will probably take me a few days (maybe a couple of weeks) to get to it a pull request. As far as I can tell, the relevant API endpoints in Trello are:

  1. GET members voted for a card (docs here: https://developers.trello.com/advanced-reference/card#get-1-cards-card-id-or-shortlink-membersvoted)
  2. POST members voted (docs here: https://developers.trello.com/advanced-reference/card#post-1-cards-card-id-or-shortlink-membersvoted)
  3. DELETE members voted (docs here: https://developers.trello.com/advanced-reference/card#delete-1-cards-card-id-or-shortlink-membersvoted-idmember)

Following the idioms of this gem, seems like the best approach would be to:

Update lib/trello/card.rb and follow the pattern for adding/removing members to add/remove votes (implements POST/DELETE describe in the list above) and then add in either the instance attributes or specific methods to make sure idMembersVoted is returned when a card is fetched and add votes to badges as necessary to make sure the count of votes is returned.

Does that sound about right?

๐Ÿ‘ sound right to me, go for it ๐Ÿ‘

@brycemcd how are you going with this feature?

@joneslee85 - I still intend to deliver on this feature but I haven't had a chance to get it complete just yet. I was traveling (in the US) at the time I opened the issue and now I'm traveling again (outside the US) so my schedule has been really disrupted.

Is there a date or a version milestone you'd like to target for this feature?

Right now my plan is to get to it when I'm back in the US in ~ 1 week but I haven't given myself a hard deadline to get it shipped. Let me know if there's a date you'd like to target please.

@brycemcd I hope to ship a new version on 31st July. If the feature could be added by then, it would be UBER awesome. Thanks much again, let me know if you need any help.

@joneslee85 That's a bit aggressive as I'm still overseas at the moment and a majority of my time this week is wrapped up in my work responsibilities.

That said, I'll attempt to get a PR open in the next couple of days to meet your new version deadline. I can't promise it, but I'll try :)

Sorry @joneslee85 I've been going at ~100% while I've been traveling and haven't been able to get this to you. I'm back home now and will aim to get you a PR by Thursday