I seem to have boxed myself into a corner here…
I have a membership site (also in Rails) and I’m using the Discourse API in order to automatically create and populate restricted forum groups for all of my user groups. This works great; I’m even giving each group a wiki post to start with. (I’ve posted my code.)
Now I’ve come across the issue that sometimes I need to manually sync up the group membership, for example when merging groups on my site or when the coordinator accidentally deleted/added people via the forum. For this purpose, I want to delete ALL Discourse group members and then re-add the ones that should be in it.
First problem: the Discourse API doesn’t seem to come with a DELETE ALL for group members, so I have to specify the names of everyone that should be deleted.
Second problem: I cannot actually retrieve the Discourse group’s current membership, because for whatever reason it’s asking me for the group NAME rather than ID. I’ve only stored the group ID on my site, because that’s what Discourse uses for the related PUT/POST/DELETE requests.
Third problem: It should be obvious, but I don’t see a way to retrieve the group’s name by supplying its ID, unless I want to retrieve all 200+ groups and iterate through them until I find one whose ID matches. This seems a ridiculous amount of trouble and also contravenes Rails conventions.
What am I missing?
EDIT: @codinghorror was really helpful last time - any ideas now?