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

[Feature Request] Allow finding boards for an organization instead of member

Open qdegraeve opened this issue 1 year ago • 4 comments

Hello,

On my app, I need to fetch all boards of my organization workspace and not only the boards that my API user has joined. To do this I had to do the following code because Trello::Board.all is scoped on Trello::Member.find(:me) :

    boards = Trello::Board.from_response(
      Trello::Board.client.get("/organizations/[my org ID]/boards", filter: "open", fields: "id,name")
    )

Also this code allowed me to pass query parameters as mentioned in the API documentation and made the request a lot lighter and faster.

Maybe Trello::Board.all could accept extra parameters to allow another scope and query parameters ?

Regards Quentin

qdegraeve avatar Dec 20 '23 08:12 qdegraeve

I'll take a look in the next few days.

hoppergee avatar Dec 21 '23 15:12 hoppergee

We have an API to fetch all boards of an organization(workspace)

organization = Trello::Organization.find(org_id)
boards = organization.boards

But it's using a legacy API /organizations/#{id}/boards/all which doesn't support query parameters. I will fix it to use /organizations/#{id}/boards with parameter support.

hoppergee avatar Dec 21 '23 18:12 hoppergee

@qdegraeve I just bump to v4.2.0. Now you can use query paramters:

organization = Trello::Organization.find(org_id)
boards = organization.boards(filter: "open", fields: "id,name")

Please have a test and hope it can help.

hoppergee avatar Dec 21 '23 18:12 hoppergee

Thank you very much, I'll give it a try.

qdegraeve avatar Dec 22 '23 16:12 qdegraeve