Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the group billable members call as described in the Gitlab documentation #593

Merged
merged 2 commits into from
Nov 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/gitlab/client/groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ def group_members(id, options = {})
get("/groups/#{url_encode id}/members", query: options)
end

# Get a list of group members that are billable.
#
# @example
# Gitlab.group_billable_members(1)
# Gitlab.group_billable_members(1, { per_page: 40 })
#
# @param [Integer] id The ID of a group.
# @param [Hash] options A customizable set of options.
# @option options [Integer] :page The page number.
# @option options [Integer] :per_page The number of results per page.
# @return [Array<Gitlab::ObjectifiedHash>]
def group_billable_members(id, options = {})
get("/groups/#{url_encode id}/billable_members", query: options)
end

# Get details of a single group member.
#
# @example
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/group_billable_members.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":1,"username":"eraymond","email":"eraymond@local.host","name":"Edward Raymond","state":"active","created_at":"2013-08-30T16:16:22Z","access_level":50},{"id":1,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-08-30T16:16:22Z","access_level":50}]
17 changes: 17 additions & 0 deletions spec/gitlab/client/groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,23 @@
end
end

describe '.group_billable_members' do
before do
stub_get('/groups/3/billable_members', 'group_billable_members')
@members = Gitlab.group_billable_members(3)
end

it 'gets the correct resource' do
expect(a_get('/groups/3/billable_members')).to have_been_made
end

it "returns information about a group's billable members" do
expect(@members).to be_a Gitlab::PaginatedResponse
expect(@members.size).to eq(2)
expect(@members[1].name).to eq('John Smith')
end
end

describe '.group_member' do
before do
stub_get('/groups/3/members/2', 'group_member')
Expand Down