A summary of data about the Ruby ecosystem.

https://github.com/NARKOZ/gitlab

Ruby wrapper and CLI for the GitLab REST API
https://github.com/NARKOZ/gitlab

Keywords

gitlab gitlab-api gitlab-cli ruby-gem

Keywords from Contributors

activerecord mvc activejob rubocop deployment code-formatter rubygems static-code-analysis rack ci

Last synced: about 8 hours ago
JSON representation

Repository metadata

Ruby wrapper and CLI for the GitLab REST API

README.md

Gitlab

Build Status
Gem version
License

website |
documentation |
gitlab-live

Gitlab is a Ruby wrapper and CLI for the GitLab API.

Installation

Install it from rubygems:

gem install gitlab

Or add to a Gemfile:

gem 'gitlab'
# gem 'gitlab', github: 'NARKOZ/gitlab'

Mac OS users can install using Homebrew (may not be the latest version):

brew install gitlab-gem

Usage

Configuration example:

Gitlab.configure do |config|
  config.endpoint       = 'https://example.net/api/v4' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] and falls back to ENV['CI_API_V4_URL']
  config.private_token  = 'qEsq1pt6HJPaNciie3MG'       # user's private token or OAuth2 access token, default: ENV['GITLAB_API_PRIVATE_TOKEN']
  # Optional
  # config.user_agent   = 'Custom User Agent'          # user agent, default: 'Gitlab Ruby Gem [version]'
  # config.sudo         = 'user'                       # username for sudo mode, default: nil
  # config.body_as_json = false                        # use application/json for all requests with a body, default: false
end

(Note: If you are using GitLab.com's hosted service, your endpoint will be https://gitlab.com/api/v4)

Usage examples:

# set an API endpoint
Gitlab.endpoint = 'https://example.net/api/v4'
# => "https://example.net/api/v4"

# set a user private token
Gitlab.private_token = 'qEsq1pt6HJPaNciie3MG'
# => "qEsq1pt6HJPaNciie3MG"

# configure a proxy server
Gitlab.http_proxy('proxyhost', 8888)
# proxy server with basic auth
Gitlab.http_proxy('proxyhost', 8888, 'proxyuser', 'strongpasswordhere')
# set timeout for responses
ENV['GITLAB_API_HTTPARTY_OPTIONS'] = '{read_timeout: 60}'

# list projects
Gitlab.projects(per_page: 5)
# => [#<Gitlab::ObjectifiedHash:0x000000023326e0 @data={"id"=>1, "code"=>"brute", "name"=>"Brute", "description"=>nil, "path"=>"brute", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x00000002331600 @data={"id"=>1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:56Z"}>, #<Gitlab::ObjectifiedHash:0x000000023450d8 @data={"id"=>2, "code"=>"mozart", "name"=>"Mozart", "description"=>nil, "path"=>"mozart", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x00000002344ca0 @data={"id"=>1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:57Z"}>, #<Gitlab::ObjectifiedHash:0x00000002344958 @data={"id"=>3, "code"=>"gitlab", "name"=>"Gitlab", "description"=>nil, "path"=>"gitlab", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x000000023447a0 @data={"id"=>1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:58Z"}>]

# initialize a new client with custom headers
g = Gitlab.client(
  endpoint: 'https://example.com/api/v4',
  private_token: 'qEsq1pt6HJPaNciie3MG',
  httparty: {
    headers: { 'Cookie' => 'gitlab_canary=true' }
  }
)
# => #<Gitlab::Client:0x00000001e62408 @endpoint="https://api.example.com", @private_token="qEsq1pt6HJPaNciie3MG", @user_agent="Gitlab Ruby Gem 2.0.0">

# get a user
user = g.user
# => #<Gitlab::ObjectifiedHash:0x00000002217990 @data={"id"=>1, "email"=>"john@example.com", "name"=>"John Smith", "bio"=>nil, "skype"=>"", "linkedin"=>"", "twitter"=>"john", "dark_scheme"=>false, "theme_id"=>1, "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>

# get a user's email
user.email
# => "john@example.com"

# set a sudo mode to perform API calls as another user
Gitlab.sudo = 'other_user'
# => "other_user"

# disable a sudo mode
Gitlab.sudo = nil
# => nil

# set the private token to an empty string to make unauthenticated API requests
Gitlab.private_token = ''
# => ""

# a paginated response
projects = Gitlab.projects(per_page: 5)

# check existence of the next page
projects.has_next_page?

# retrieve the next page
projects.next_page

# iterate all projects
projects.auto_paginate do |project|
  # do something
end

# retrieve all projects as an array
projects.auto_paginate

For more information, refer to documentation.

CLI

It is possible to use this gem as a command line interface to GitLab. In order to make that work you need to set a few environment variables:

export GITLAB_API_ENDPOINT=https://gitlab.example.com/api/v4
export GITLAB_API_PRIVATE_TOKEN=<your private token from /profile/personal_access_tokens>

# This one is optional and can be used to set any HTTParty option you may need
# using YAML hash syntax. For example, this is how you would disable SSL
# verification (useful if using a self-signed cert).
export GITLAB_API_HTTPARTY_OPTIONS="{verify: false}"

Usage:

When you want to know which CLI commands are supported, take a look at the client commands implemented in this gem. Any of those methods can be called as a command by passing the parameters of the commands as parameters of the CLI.

Usage examples:

# list users
# see: https://www.rubydoc.info/gems/gitlab/Gitlab/Client/Users#users-instance_method
gitlab users

# get current user
# see: https://www.rubydoc.info/gems/gitlab/Gitlab/Client/Users#user-instance_method
gitlab user

# get a user
# see: https://www.rubydoc.info/gems/gitlab/Gitlab/Client/Users#user-instance_method
gitlab user 2

# filter output
gitlab user --only=id,username

gitlab user --except=email,bio

# get a user and render result as json
gitlab user 2 --json

# passing options hash to a command (use YAML)
# see: https://www.rubydoc.info/gems/gitlab/Gitlab/Client/MergeRequests#create_merge_request-instance_method
gitlab create_merge_request 4 "New merge request" "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"

CLI Shell

Usage examples:

# start shell session
gitlab shell

# list available commands
gitlab> help

# list groups
gitlab> groups

# protect a branch
gitlab> protect_branch 1 master

# passing options hash to a command (use YAML)
gitlab> create_merge_request 4 "New merge request" "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"

Web version is available at https://gitlab-live.herokuapp.com
For more information, refer to website.

Development

With a dockerized GitLab instance

docker-compose up -d gitlab # Will start the GitLab instance in the background (approx. 3 minutes)

After a while, your GitLab instance will be accessible on http://localhost:3000.

Once you have set your new root password, you can login with the root user.

You can now setup a personal access token here: http://localhost:3000/profile/personal_access_tokens

Once you have your token, set the variables to the correct values in the docker.env file.

Then, launch the tool:

docker-compose run app
Gitlab.users
=> [#<Gitlab::ObjectifiedHash:47231290771040 {hash: {"id"=>1, "name"=>"Administrator", "username"=>"root", ...]

To launch the specs:

docker-compose run app rake spec

Want to use GitLab Enterprise?

Just change the image from gitlab/gitlab-ce:latest to gitlab/gitlab-ee:latest in the docker-compose.yml file.

With an external GitLab instance

First, set the variables to the correct values in the docker.env file.

Then, launch the tool:

docker-compose run app
Gitlab.users
=> [#<Gitlab::ObjectifiedHash:47231290771040 {hash: {"id"=>1, "name"=>"Administrator", "username"=>"root", ...]

To launch the specs,

docker-compose run app rake spec

Without Docker

After checking out the repo, run bin/setup to install dependencies. Then, run
rake spec to run the tests. You can also run bin/console for an interactive
prompt that will allow you to experiment.

For more information see CONTRIBUTING.md.

License

Released under the BSD 2-clause license. See LICENSE.txt for details.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 3 days ago

Total Commits: 778
Total Committers: 213
Avg Commits per committer: 3.653
Development Distribution Score (DDS): 0.634

Commits in past year: 31
Committers in past year: 9
Avg Commits per committer in past year: 3.444
Development Distribution Score (DDS) in past year: 0.355

Name Email Commits
Nihad Abbasov n****d@4****n 285
Sean Edge a****e@g****m 62
Akash Srivastava a****v@y****n 27
Akash Srivastava a****1@g****m 15
Robert Speicher r****r@g****m 14
nanofi n****u@g****m 10
Izaak Alpert i****t@b****m 10
Helmut Januschka h****t@j****m 9
Andrejs a****s@g****m 8
AkashSrivastava a****a@A****l 7
Thomas Wood t****9@i****k 6
Gustavo Araujo g****v@g****m 6
Connor Shea c****a@g****m 6
Joe Marty j****y@i****m 6
Léo Colombaro g****t@c****r 5
Dominik Sander g****t@d****e 5
Chris D'Ambrosio c****o@g****m 5
Michael McCormick m****k@t****m 5
brettmortensen 1****n 5
Pablo Opazo p****d@m****m 4
Akash Srivastava a****a@A****l 4
Craig Miskell c****l@g****m 4
Rohan Garg r****n@g****o 4
Azamat Khudaygulov a****t@h****u 4
Hugues Lismonde h****s@e****t 4
hassaku h****s@g****m 4
Stephen Russett s****t@g****m 3
Stefan Rohde i****o@r****e 3
Ronan Potage p****e@m****m 3
Pim Snel p****m@l****l 3
and 183 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 26 days ago

Total issues: 64
Total pull requests: 127
Average time to close issues: 3 months
Average time to close pull requests: 3 months
Total issue authors: 59
Total pull request authors: 60
Average comments per issue: 1.97
Average comments per pull request: 1.48
Merged pull request: 89
Bot issues: 0
Bot pull requests: 0

Past year issues: 8
Past year pull requests: 19
Past year average time to close issues: 2 months
Past year average time to close pull requests: about 2 months
Past year issue authors: 7
Past year pull request authors: 10
Past year average comments per issue: 1.0
Past year average comments per pull request: 0.84
Past year merged pull request: 9
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/NARKOZ/gitlab

Top Issue Authors

  • ltickett (2)
  • gegenelnet (2)
  • reuben453 (2)
  • Nowaker (2)
  • balasankarc (2)
  • crsantos (1)
  • thedrummeraki (1)
  • NARKOZ (1)
  • trisys3 (1)
  • orafaaraujo (1)
  • slondr (1)
  • Lt1201 (1)
  • cortesoft (1)
  • tnir (1)
  • wkoszek (1)

Top Pull Request Authors

  • andrcuns (9)
  • balasankarc (8)
  • akashdotsrivastava (5)
  • tduehr (5)
  • capripot (5)
  • StingRayZA (4)
  • seanmil (4)
  • vmlrodrigues (4)
  • ddieulivol (4)
  • reuben453 (4)
  • shoshoi (4)
  • rspeicher (3)
  • garaujodev (3)
  • mipmip (3)
  • jasper-eljakim (2)

Top Issue Labels

  • stale (20)
  • help wanted (11)
  • enhancement (10)
  • bug (5)
  • question (3)
  • good first issue (3)
  • hacktoberfest-accepted (1)

Top Pull Request Labels

  • stale (20)
  • hacktoberfest-accepted (1)

Package metadata

gem.coop: gitlab

Ruby client and CLI for GitLab API

  • Homepage: https://github.com/NARKOZ/gitlab
  • Documentation: http://www.rubydoc.info/gems/gitlab/
  • Licenses: BSD-2-Clause
  • Latest release: 6.1.0 (published about 1 month ago)
  • Last Synced: 2026-01-04T20:32:57.732Z (2 days ago)
  • Versions: 42
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 103,391,069 Total
  • Docker Downloads: 436,741,268
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.13%
    • Downloads: 0.246%
    • Docker downloads count: 0.273%
  • Maintainers (1)
  • Funding:
    • https://github.com/NARKOZ/SponsorMe
rubygems.org: gitlab

Ruby client and CLI for GitLab API

  • Homepage: https://github.com/NARKOZ/gitlab
  • Documentation: http://www.rubydoc.info/gems/gitlab/
  • Licenses: BSD-2-Clause
  • Latest release: 6.1.0 (published about 1 month ago)
  • Last Synced: 2026-01-05T04:33:16.860Z (2 days ago)
  • Versions: 42
  • Dependent Packages: 105
  • Dependent Repositories: 1,979
  • Downloads: 103,397,289 Total
  • Docker Downloads: 436,741,268
  • Rankings:
    • Dependent packages count: 0.306%
    • Docker downloads count: 0.336%
    • Downloads: 0.395%
    • Dependent repos count: 0.699%
    • Average: 0.819%
    • Forks count: 1.315%
    • Stargazers count: 1.863%
  • Maintainers (1)
  • Funding:
    • https://github.com/NARKOZ/SponsorMe
proxy.golang.org: github.com/narkoz/gitlab

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/narkoz/gitlab#section-documentation
  • Licenses: bsd-2-clause
  • Latest release: v6.1.0+incompatible (published about 1 month ago)
  • Last Synced: 2026-01-03T20:04:09.367Z (3 days ago)
  • Versions: 42
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 6.999%
    • Average: 8.173%
    • Dependent repos count: 9.346%
proxy.golang.org: github.com/NARKOZ/gitlab

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/NARKOZ/gitlab#section-documentation
  • Licenses: bsd-2-clause
  • Latest release: v6.1.0+incompatible (published about 1 month ago)
  • Last Synced: 2026-01-03T20:04:09.641Z (3 days ago)
  • Versions: 42
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 6.999%
    • Average: 8.173%
    • Dependent repos count: 9.346%
gem.coop: fs-gitlab

Ruby client and CLI for GitLab API

  • Homepage: https://github.com/NARKOZ/gitlab
  • Documentation: http://www.rubydoc.info/gems/fs-gitlab/
  • Licenses: BSD-2-Clause
  • Latest release: 4.19.3 (published almost 2 years ago)
  • Last Synced: 2026-01-03T20:04:10.128Z (3 days ago)
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 3,557 Total
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 28.202%
    • Downloads: 84.605%
  • Maintainers (1)
  • Funding:
    • https://github.com/NARKOZ/SponsorMe
formulae.brew.sh: gitlab-gem

Ruby client and CLI for GitLab API

  • Homepage: https://narkoz.github.io/gitlab/
  • Licenses: BSD-2-Clause
  • Latest release: 6.1.0 (published about 1 month ago)
  • Last Synced: 2026-01-03T20:04:09.384Z (3 days ago)
  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 121 Last month
  • Rankings:
    • Forks count: 6.417%
    • Stargazers count: 16.552%
    • Dependent packages count: 18.481%
    • Dependent repos count: 29.193%
    • Average: 29.256%
    • Downloads: 75.639%
gem.coop: gitlab-akerl

Ruby client and CLI for GitLab API

  • Homepage: https://github.com/narkoz/gitlab
  • Documentation: http://www.rubydoc.info/gems/gitlab-akerl/
  • Licenses: BSD
  • Latest release: 4.0.0 (published almost 9 years ago)
  • Last Synced: 2026-01-03T20:04:09.538Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 2,878 Total
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 29.346%
    • Downloads: 88.037%
  • Maintainers (1)
rubygems.org: gitlab-akerl

Ruby client and CLI for GitLab API

  • Homepage: https://github.com/narkoz/gitlab
  • Documentation: http://www.rubydoc.info/gems/gitlab-akerl/
  • Licenses: BSD
  • Latest release: 4.0.0 (published almost 9 years ago)
  • Last Synced: 2026-01-03T20:04:09.581Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 2,878 Total
  • Rankings:
    • Forks count: 1.207%
    • Stargazers count: 1.702%
    • Dependent packages count: 15.706%
    • Average: 31.223%
    • Dependent repos count: 46.782%
    • Downloads: 90.717%
  • Maintainers (1)
rubygems.org: fs-gitlab

Ruby client and CLI for GitLab API

  • Homepage: https://github.com/NARKOZ/gitlab
  • Documentation: http://www.rubydoc.info/gems/fs-gitlab/
  • Licenses: BSD-2-Clause
  • Latest release: 4.19.3 (published almost 2 years ago)
  • Last Synced: 2026-01-03T20:04:10.124Z (3 days ago)
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 3,557 Total
  • Rankings:
    • Forks count: 1.258%
    • Stargazers count: 1.798%
    • Dependent packages count: 15.706%
    • Average: 32.62%
    • Dependent repos count: 46.779%
    • Downloads: 97.56%
  • Maintainers (1)
  • Funding:
    • https://github.com/NARKOZ/SponsorMe
gem.coop: gitlab-faraday

Ruby wrapper and target for the GitLab REST API

  • Homepage: https://github.com/NARKOZ/gitlab
  • Documentation: http://www.rubydoc.info/gems/gitlab-faraday/
  • Licenses: BSD-2-Clause
  • Latest release: 5.1.0 (published 8 days ago)
  • Last Synced: 2026-01-03T13:36:10.619Z (4 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1,288 Total
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 33.32%
    • Downloads: 99.961%
  • Maintainers (1)
rubygems.org: gitlab-faraday

Ruby wrapper and target for the GitLab REST API

  • Homepage: https://github.com/NARKOZ/gitlab
  • Documentation: http://www.rubydoc.info/gems/gitlab-faraday/
  • Licenses: BSD-2-Clause
  • Latest release: 5.1.0 (published 8 days ago)
  • Last Synced: 2026-01-03T14:17:43.324Z (4 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1,288 Total
  • Rankings:
    • Dependent packages count: 14.134%
    • Dependent repos count: 43.292%
    • Average: 50.03%
    • Downloads: 92.664%
  • Maintainers (1)

Dependencies

Gemfile rubygems
  • pry >= 0
  • rubocop >= 0
  • rubocop-performance >= 0
  • rubocop-rspec >= 0
gitlab.gemspec rubygems
  • rake >= 0 development
  • rspec >= 0 development
  • webmock >= 0 development
  • httparty ~> 0.20
  • terminal-table >= 1.5.1
.github/workflows/ci.yml actions
  • actions/checkout v2 composite
  • ruby/setup-ruby v1 composite
.github/workflows/stale.yml actions
  • actions/stale v4 composite
Dockerfile docker
  • ruby 2.7 build
docker-compose.yml docker
  • gitlab/gitlab-ce latest
.github/workflows/pages.yml actions
  • actions/checkout v6 composite
  • actions/configure-pages v5 composite
  • actions/deploy-pages v4 composite
  • actions/setup-node v6 composite
  • actions/upload-pages-artifact v4 composite
package-lock.json npm
  • 156 dependencies
package.json npm
  • vitepress ^2.0.0-alpha.15 development
.github/workflows/release.yml actions
  • actions/checkout v6 composite
  • ruby/setup-ruby v1 composite
  • rubygems/release-gem v1 composite

Score: 33.15112174992714