ruby-trello icon indicating copy to clipboard operation
ruby-trello copied to clipboard

Access actions for cards, list, boards, etc

Open Larusso opened this issue 10 years ago • 2 comments

One can access a list of actions (optional filtered) for cards, boards etc. It would be super helpfull to implement that as well. The main problem is the different information stored in Trello::Action. This is the payload for a commentCard action.

{
    "id": "bla",
    "idMemberCreator": "bla",
    "data": {
      "list": {
        "name": "Done",
        "id": "bla"
      },
      "board": {
        "shortLink": "bla",
        "name": "Test Board",
        "id": "bla"
      },
      "card": {
        "shortLink": "bla",
        "idShort": 63,
        "name": "task 1",
        "id": "bla"
      },
      "text": "lalalal"
    },
    "type": "commentCard",
    "date": "2015-03-24T16:26:59.726Z",
    "memberCreator": {
      "id": "bla",
      "avatarHash": "bla",
      "fullName": "Manfred Endres",
      "initials": "ME",
      "username": "manfredendres"
    }

The imortant part is in the data field (text). Right now we lose this information because we only map the generic information from the payload. The problem is also that there is a lot of different action types:


    addAttachmentToCard
    addChecklistToCard
    addMemberToBoard
    addMemberToCard
    addMemberToOrganization
    addToOrganizationBoard
    commentCard
    convertToCardFromCheckItem
    copyBoard
    copyCard
    copyCommentCard
    createBoard
    createCard
    createList
    createOrganization
    deleteAttachmentFromCard
    deleteBoardInvitation
    deleteCard
    deleteOrganizationInvitation
    disablePowerUp
    emailCard
    enablePowerUp
    makeAdminOfBoard
    makeNormalMemberOfBoard
    makeNormalMemberOfOrganization
    makeObserverOfBoard
    memberJoinedTrello
    moveCardFromBoard
    moveCardToBoard
    moveListFromBoard
    moveListToBoard
    removeChecklistFromCard
    removeFromOrganizationBoard
    removeMemberFromCard
    unconfirmedBoardInvitation
    unconfirmedOrganizationInvitation
    updateBoard
    updateCard
    updateCard:closed
    updateCard:desc
    updateCard:idList
    updateCard:name
    updateCheckItemStateOnCard
    updateChecklist
    updateList
    updateList:closed
    updateList:name
    updateMember
    updateOrganization

each one differs in the payload. We need a way to access these information. This will also help to work with webhooks. Are there any sugestions? I`m willing to implement. I created custom subclasses in my current project (just three or four) But this is no solution for all types.

Larusso avatar Mar 24 '15 16:03 Larusso

I just saw the has_actions.rb macro. There is still the issue with the different types though.

Larusso avatar Mar 24 '15 19:03 Larusso

@Larusso Would you have any ideas on what would be a good way to handle this?

jeremytregunna avatar Nov 03 '15 22:11 jeremytregunna