Skip to content

Instantly share code, notes, and snippets.

@trilitheus
Last active August 29, 2015 13:57
Show Gist options
  • Save trilitheus/9537827 to your computer and use it in GitHub Desktop.
Save trilitheus/9537827 to your computer and use it in GitHub Desktop.
require 'gitlab'
g = Gitlab.client(:endpoint => 'http(s)://gitlaburl/api/v3', :private_token => 'userprivatetoken')
user = g.user
# use per_page setting as gitlab uses pagination with default of 20 items
projects = g.projects(:per_page => '100')
puts "Projects accessible by user #{user.name}:"
projects.reverse.each do |project|
puts " #{project.id} => #{project.name}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment