sumoheavy / jira-ruby

A Ruby gem for the JIRA REST API
MIT License
654 stars 411 forks source link

Add groups as a resource #262

Open tieleman opened 6 years ago

tieleman commented 6 years ago

JIRA has the notion of groups that users can belong to. It would be nice if we could query the groups for its members (for example to implement some form of access control). Relevant REST endpoints are here:

https://docs.atlassian.com/jira/REST/cloud/#api/2/group

Specifically, I think group/member is the most relevant one.

SimonMiaou commented 6 years ago

Hi @tieleman

Adding new resource should not be too complicated. Would you want to try submitting a PR for it?

tieleman commented 6 years ago

I did have a quick look at it, but the group resource doesn't behave like most of the other resources. I.e., it doesn't let you fetch members based with a /group/{$id}/member REST call (as you'd expect in a REST API). It has a /group/member call which takes a groupname parameter. What would be a logical place to put this? I guess not in a GroupFactory since it doesn't create groups.

SimonMiaou commented 6 years ago

I guess we'll need some custom code as the API is not really following the other endpoints. Fetching the users is /member but creating one is on /user 😕

ab320012 commented 6 years ago

@SimonMiaou @tieleman

You may be able to do the /groups/member?groupname stuff in a similar method to this in the Group resource

https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/resource/project.rb#L19,L28