{"id":13452382,"url":"https://github.com/NARKOZ/gitlab","last_synced_at":"2025-03-23T19:34:09.354Z","repository":{"id":4755126,"uuid":"5905144","full_name":"NARKOZ/gitlab","owner":"NARKOZ","description":"Ruby wrapper and CLI for the GitLab REST API","archived":false,"fork":false,"pushed_at":"2024-10-29T11:17:26.000Z","size":1829,"stargazers_count":1061,"open_issues_count":9,"forks_count":396,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-10-29T12:59:31.417Z","etag":null,"topics":["gitlab","gitlab-api","gitlab-cli","hacktoberfest","ruby-gem"],"latest_commit_sha":null,"homepage":"https://narkoz.github.io/gitlab","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NARKOZ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"NARKOZ","custom":"https://github.com/NARKOZ/SponsorMe"}},"created_at":"2012-09-21T17:46:11.000Z","updated_at":"2024-10-29T11:17:25.000Z","dependencies_parsed_at":"2023-07-05T20:46:24.402Z","dependency_job_id":"2519fd89-03ba-423c-8d06-db178e8b830c","html_url":"https://github.com/NARKOZ/gitlab","commit_stats":{"total_commits":747,"total_committers":218,"mean_commits":3.426605504587156,"dds":0.8192771084337349,"last_synced_commit":"91918434a4f19d0dc685069038e321a0026c48ff"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NARKOZ%2Fgitlab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NARKOZ%2Fgitlab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NARKOZ%2Fgitlab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NARKOZ%2Fgitlab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NARKOZ","download_url":"https://codeload.github.com/NARKOZ/gitlab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244693131,"owners_count":20494443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitlab","gitlab-api","gitlab-cli","hacktoberfest","ruby-gem"],"created_at":"2024-07-31T07:01:22.524Z","updated_at":"2025-03-23T19:34:09.314Z","avatar_url":"https://github.com/NARKOZ.png","language":"Ruby","readme":"# Gitlab\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/NARKOZ/gitlab/ci.yml?branch=master)](https://github.com/NARKOZ/gitlab/actions/workflows/ci.yml)\n[![Gem version](https://img.shields.io/gem/v/gitlab.svg)](https://rubygems.org/gems/gitlab)\n[![License](https://img.shields.io/badge/license-BSD-red.svg)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt)\n\n[website](https://narkoz.github.io/gitlab) |\n[documentation](https://www.rubydoc.info/gems/gitlab/frames) |\n[gitlab-live](https://github.com/NARKOZ/gitlab-live)\n\nGitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ee/api/index.html).\n\n## Installation\n\nInstall it from rubygems:\n\n```sh\ngem install gitlab\n```\n\nOr add to a Gemfile:\n\n```ruby\ngem 'gitlab'\n# gem 'gitlab', github: 'NARKOZ/gitlab'\n```\n\nMac OS users can install using Homebrew (may not be the latest version):\n\n```sh\nbrew install gitlab-gem\n```\n\n## Usage\n\nConfiguration example:\n\n```ruby\nGitlab.configure do |config|\n  config.endpoint       = 'https://example.net/api/v4' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] and falls back to ENV['CI_API_V4_URL']\n  config.private_token  = 'qEsq1pt6HJPaNciie3MG'       # user's private token or OAuth2 access token, default: ENV['GITLAB_API_PRIVATE_TOKEN']\n  # Optional\n  # config.user_agent   = 'Custom User Agent'          # user agent, default: 'Gitlab Ruby Gem [version]'\n  # config.sudo         = 'user'                       # username for sudo mode, default: nil\nend\n```\n\n(Note: If you are using GitLab.com's hosted service, your endpoint will be `https://gitlab.com/api/v4`)\n\nUsage examples:\n\n```ruby\n# set an API endpoint\nGitlab.endpoint = 'https://example.net/api/v4'\n# =\u003e \"https://example.net/api/v4\"\n\n# set a user private token\nGitlab.private_token = 'qEsq1pt6HJPaNciie3MG'\n# =\u003e \"qEsq1pt6HJPaNciie3MG\"\n\n# configure a proxy server\nGitlab.http_proxy('proxyhost', 8888)\n# proxy server with basic auth\nGitlab.http_proxy('proxyhost', 8888, 'proxyuser', 'strongpasswordhere')\n# set timeout for responses\nENV['GITLAB_API_HTTPARTY_OPTIONS'] = '{read_timeout: 60}'\n\n# list projects\nGitlab.projects(per_page: 5)\n# =\u003e [#\u003cGitlab::ObjectifiedHash:0x000000023326e0 @data={\"id\"=\u003e1, \"code\"=\u003e\"brute\", \"name\"=\u003e\"Brute\", \"description\"=\u003enil, \"path\"=\u003e\"brute\", \"default_branch\"=\u003enil, \"owner\"=\u003e#\u003cGitlab::ObjectifiedHash:0x00000002331600 @data={\"id\"=\u003e1, \"email\"=\u003e\"john@example.com\", \"name\"=\u003e\"John Smith\", \"blocked\"=\u003efalse, \"created_at\"=\u003e\"2012-09-17T09:41:56Z\"}\u003e, \"private\"=\u003etrue, \"issues_enabled\"=\u003etrue, \"merge_requests_enabled\"=\u003etrue, \"wall_enabled\"=\u003etrue, \"wiki_enabled\"=\u003etrue, \"created_at\"=\u003e\"2012-09-17T09:41:56Z\"}\u003e, #\u003cGitlab::ObjectifiedHash:0x000000023450d8 @data={\"id\"=\u003e2, \"code\"=\u003e\"mozart\", \"name\"=\u003e\"Mozart\", \"description\"=\u003enil, \"path\"=\u003e\"mozart\", \"default_branch\"=\u003enil, \"owner\"=\u003e#\u003cGitlab::ObjectifiedHash:0x00000002344ca0 @data={\"id\"=\u003e1, \"email\"=\u003e\"john@example.com\", \"name\"=\u003e\"John Smith\", \"blocked\"=\u003efalse, \"created_at\"=\u003e\"2012-09-17T09:41:56Z\"}\u003e, \"private\"=\u003etrue, \"issues_enabled\"=\u003etrue, \"merge_requests_enabled\"=\u003etrue, \"wall_enabled\"=\u003etrue, \"wiki_enabled\"=\u003etrue, \"created_at\"=\u003e\"2012-09-17T09:41:57Z\"}\u003e, #\u003cGitlab::ObjectifiedHash:0x00000002344958 @data={\"id\"=\u003e3, \"code\"=\u003e\"gitlab\", \"name\"=\u003e\"Gitlab\", \"description\"=\u003enil, \"path\"=\u003e\"gitlab\", \"default_branch\"=\u003enil, \"owner\"=\u003e#\u003cGitlab::ObjectifiedHash:0x000000023447a0 @data={\"id\"=\u003e1, \"email\"=\u003e\"john@example.com\", \"name\"=\u003e\"John Smith\", \"blocked\"=\u003efalse, \"created_at\"=\u003e\"2012-09-17T09:41:56Z\"}\u003e, \"private\"=\u003etrue, \"issues_enabled\"=\u003etrue, \"merge_requests_enabled\"=\u003etrue, \"wall_enabled\"=\u003etrue, \"wiki_enabled\"=\u003etrue, \"created_at\"=\u003e\"2012-09-17T09:41:58Z\"}\u003e]\n\n# initialize a new client with custom headers\ng = Gitlab.client(\n  endpoint: 'https://example.com/api/v4',\n  private_token: 'qEsq1pt6HJPaNciie3MG',\n  httparty: {\n    headers: { 'Cookie' =\u003e 'gitlab_canary=true' }\n  }\n)\n# =\u003e #\u003cGitlab::Client:0x00000001e62408 @endpoint=\"https://api.example.com\", @private_token=\"qEsq1pt6HJPaNciie3MG\", @user_agent=\"Gitlab Ruby Gem 2.0.0\"\u003e\n\n# get a user\nuser = g.user\n# =\u003e #\u003cGitlab::ObjectifiedHash:0x00000002217990 @data={\"id\"=\u003e1, \"email\"=\u003e\"john@example.com\", \"name\"=\u003e\"John Smith\", \"bio\"=\u003enil, \"skype\"=\u003e\"\", \"linkedin\"=\u003e\"\", \"twitter\"=\u003e\"john\", \"dark_scheme\"=\u003efalse, \"theme_id\"=\u003e1, \"blocked\"=\u003efalse, \"created_at\"=\u003e\"2012-09-17T09:41:56Z\"}\u003e\n\n# get a user's email\nuser.email\n# =\u003e \"john@example.com\"\n\n# set a sudo mode to perform API calls as another user\nGitlab.sudo = 'other_user'\n# =\u003e \"other_user\"\n\n# disable a sudo mode\nGitlab.sudo = nil\n# =\u003e nil\n\n# set the private token to an empty string to make unauthenticated API requests\nGitlab.private_token = ''\n# =\u003e \"\"\n\n# a paginated response\nprojects = Gitlab.projects(per_page: 5)\n\n# check existence of the next page\nprojects.has_next_page?\n\n# retrieve the next page\nprojects.next_page\n\n# iterate all projects\nprojects.auto_paginate do |project|\n  # do something\nend\n\n# retrieve all projects as an array\nprojects.auto_paginate\n```\n\nFor more information, refer to [documentation](https://www.rubydoc.info/gems/gitlab/frames).\n\n## CLI\n\nIt 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:\n```sh\nexport GITLAB_API_ENDPOINT=https://gitlab.example.com/api/v4\nexport GITLAB_API_PRIVATE_TOKEN=\u003cyour private token from /profile/personal_access_tokens\u003e\n\n# This one is optional and can be used to set any HTTParty option you may need\n# using YAML hash syntax. For example, this is how you would disable SSL\n# verification (useful if using a self-signed cert).\nexport GITLAB_API_HTTPARTY_OPTIONS=\"{verify: false}\"\n```\n\nUsage:\n\nWhen you want to know which CLI commands are supported, take a look at the client [commands implemented in this gem](https://www.rubydoc.info/gems/gitlab/4.18.0/Gitlab/Client). Any of those methods can be called as a command by passing the parameters of the commands as parameters of the CLI.\n\nUsage examples:\n\n```sh\n# list users\n# see: https://www.rubydoc.info/gems/gitlab/Gitlab/Client/Users#users-instance_method\ngitlab users\n\n# get current user\n# see: https://www.rubydoc.info/gems/gitlab/Gitlab/Client/Users#user-instance_method\ngitlab user\n\n# get a user\n# see: https://www.rubydoc.info/gems/gitlab/Gitlab/Client/Users#user-instance_method\ngitlab user 2\n\n# filter output\ngitlab user --only=id,username\n\ngitlab user --except=email,bio\n\n# get a user and render result as json\ngitlab user 2 --json\n\n# passing options hash to a command (use YAML)\n# see: https://www.rubydoc.info/gems/gitlab/Gitlab/Client/MergeRequests#create_merge_request-instance_method\ngitlab create_merge_request 4 \"New merge request\" \"{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}\"\n\n```\n\n## CLI Shell\n\nUsage examples:\n\n```sh\n# start shell session\ngitlab shell\n\n# list available commands\ngitlab\u003e help\n\n# list groups\ngitlab\u003e groups\n\n# protect a branch\ngitlab\u003e protect_branch 1 master\n\n# passing options hash to a command (use YAML)\ngitlab\u003e create_merge_request 4 \"New merge request\" \"{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}\"\n```\n\nWeb version is available at https://gitlab-live.herokuapp.com  \nFor more information, refer to [website](https://narkoz.github.io/gitlab).\n\n## Development\n\n### With a dockerized GitLab instance\n\n```shell\ndocker-compose up -d gitlab # Will start the GitLab instance in the background (approx. 3 minutes)\n```\n\nAfter a while, your GitLab instance will be accessible on http://localhost:3000.\n\nOnce you have set your new root password, you can login with the root user.\n\nYou can now setup a personal access token here: http://localhost:3000/profile/personal_access_tokens\n\nOnce you have your token, set the variables to the correct values in the `docker.env` file.\n\nThen, launch the tool:\n\n```shell\ndocker-compose run app\n```\n\n```ruby\nGitlab.users\n=\u003e [#\u003cGitlab::ObjectifiedHash:47231290771040 {hash: {\"id\"=\u003e1, \"name\"=\u003e\"Administrator\", \"username\"=\u003e\"root\", ...]\n```\n\nTo launch the specs:\n\n```shell\ndocker-compose run app rake spec\n```\n\n#### Want to use GitLab Enterprise?\n\nJust change the image from `gitlab/gitlab-ce:latest` to `gitlab/gitlab-ee:latest` in the `docker-compose.yml` file.\n\n### With an external GitLab instance\n\nFirst, set the variables to the correct values in the `docker.env` file.\n\nThen, launch the tool:\n\n```shell\ndocker-compose run app\n```\n\n```ruby\nGitlab.users\n=\u003e [#\u003cGitlab::ObjectifiedHash:47231290771040 {hash: {\"id\"=\u003e1, \"name\"=\u003e\"Administrator\", \"username\"=\u003e\"root\", ...]\n```\n\nTo launch the specs,\n\n```shell\ndocker-compose run app rake spec\n```\n\n### Without Docker\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run\n`rake spec` to run the tests. You can also run `bin/console` for an interactive\nprompt that will allow you to experiment.\n\nFor more information see [CONTRIBUTING.md](https://github.com/NARKOZ/gitlab/blob/master/CONTRIBUTING.md).\n\n## License\n\nReleased under the BSD 2-clause license. See LICENSE.txt for details.\n","funding_links":["https://github.com/sponsors/NARKOZ","https://github.com/NARKOZ/SponsorMe"],"categories":["Ruby","Third-party APIs"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNARKOZ%2Fgitlab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNARKOZ%2Fgitlab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNARKOZ%2Fgitlab/lists"}