LoginSignup
3
3

More than 5 years have passed since last update.

GitLab API | gitlab gem で グループの一覧を取得する

Posted at

GitLab API | gitlab gem で グループの一覧を取得する

概要

gitlab gem で グループの一覧を取得します

サンプル

require 'gitlab'
require 'tbpgr_utils'

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

bulk_puts_eval binding, <<-EOS
groups.first.id
groups.first.name
groups.first.path
groups.first.owner_id
EOS

__END__
下記はTbpgrUtils gemの機能
bulk_puts_eval

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

出力

groups.first.id       # => 4
groups.first.name     # => "SampleGroup"
groups.first.path     # => "samplegroup"
groups.first.owner_id # => nil

参照

3
3
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
3
3