LoginSignup
4
4

More than 5 years have passed since last update.

GitLab API | gitlab gem で ユーザーの一覧を取得する

Posted at

GitLab API | gitlab gem で ユーザーの一覧を取得する

概要

gitlab gem で ユーザーの一覧を取得します

サンプル

require 'gitlab'
require 'pp'
require 'tbpgr_utils'

Gitlab.configure do |config|
  config.endpoint       = 'http://some_path/api/v3' 
  config.private_token  = 'your token'
end
users =  Gitlab.users

bulk_puts_eval binding, <<-EOS
users.first.id
users.first.username
users.first.state
users.first.is_admin
users.first.email
users.first.can_create_project
EOS

__END__
下記はTbpgrUtils gemの機能
bulk_puts_eval

https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils

出力

users.first.id                 # => 3
users.first.username           # => "hoge"
users.first.state              # => "active"
users.first.is_admin           # => true
users.first.email              # => "hoge@hogehoge_higehige.io"
users.first.can_create_project # => true

参照

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4