Method: Gitlab::Client::Users#create_user

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

#create_user(*args) ⇒ Gitlab::ObjectifiedHash

Creates a new user. Requires authentication from an admin account.

Examples:

Gitlab.create_user('[email protected]', 'secret', 'joe', { name: 'Joe Smith' })
or
Gitlab.create_user('[email protected]', 'secret', 'joe')

Parameters:

  • email(required) (String)

    The email of a user.

  • password(required) (String)

    The password of a user.

  • username(required) (String)

    The username of a user.

  • options (Hash)

    A customizable set of options.

Returns:

Raises:

  • (ArgumentError)


52
53
54
55
56
57
58
59
# File 'lib/gitlab/client/users.rb', line 52

def create_user(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  raise ArgumentError, 'Missing required parameters' unless args[2]

  body = { email: args[0], password: args[1], username: args[2], name: args[0] }
  body.merge!(options)
  post('/users', body: body)
end