GitLab API | gitlab gem で 新規ユーザーの作成
概要
gitlab gem で 新規ユーザーの作成
サンプル
require 'gitlab'
Gitlab.configure do |config|
config.endpoint = 'http://some_path/api/v3'
config.private_token = 'your token'
end
puts Gitlab.users.size # => この段階では 1(初期の管理者ユーザー分)
Gitlab.create_user('hoge@hogehoge_hige.jp', 'sample_pass', username: 'hoge')
Gitlab.create_user('hige@hogehoge_hige.jp', 'sample_pass', username: 'hige')
puts Gitlab.users.size # => この段階では 3
出力
1
3
補足
- username は GitLab API の必須項目
- name を指定しないと email が name として設定される
参照
-
GitLab gem RubyGems
https://rubygems.org/gems/gitlab -
GitLab gem GitHub
https://github.com/NARKOZ/gitlab