Method: Gitlab::Client::Projects#add_team_member

Defined in:
lib/gitlab/client/projects.rb

#add_team_member(project, id, access_level, options = {}) ⇒ Gitlab::ObjectifiedHash

Adds a user to project team.

Examples:

Gitlab.add_team_member('gitlab', 2, 40)
Gitlab.add_team_member('gitlab', 2, 40, { expires_at: "2018-12-31"})

Parameters:

  • project (Integer, String)

    The ID or path of a project.

  • id (Integer)

    The ID of a user.

  • access_level (Integer)

    The access level to project.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :expires_at (String)

    A date string in the format YEAR-MONTH-DAY.

Returns:



148
149
150
151
# File 'lib/gitlab/client/projects.rb', line 148

def add_team_member(project, id, access_level, options = {})
  body = { user_id: id, access_level: access_level }.merge(options)
  post("/projects/#{url_encode project}/members", body: body)
end