Update upstream source from tag 'upstream/4.14.1'
Update to upstream version '4.14.1'
with Debian dir 386c127654268e3baa0ab6b6512625bb8e4bdc48
Daniel Leidert
4 years ago
0 | # These are supported funding model platforms | |
1 | ||
2 | github: NARKOZ | |
3 | patreon: # Replace with a single Patreon username | |
4 | open_collective: # Replace with a single Open Collective username | |
5 | ko_fi: # Replace with a single Ko-fi username | |
6 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | |
7 | custom: # Replace with a single custom sponsorship URL |
5 | 5 | exemptLabels: |
6 | 6 | - pinned |
7 | 7 | - security |
8 | - contribution welcome | |
8 | - help wanted | |
9 | 9 | # Label to use when marking an issue as stale |
10 | 10 | staleLabel: stale |
11 | 11 | # Comment to post when marking an issue as stale. Set to `false` to disable |
0 | name: Ruby Gem | |
1 | ||
2 | on: | |
3 | push: | |
4 | tags: | |
5 | - v* | |
6 | ||
7 | jobs: | |
8 | build: | |
9 | name: Build + Publish | |
10 | runs-on: ubuntu-latest | |
11 | steps: | |
12 | - uses: actions/checkout@v2 | |
13 | - name: Set up Ruby 2.7 | |
14 | uses: actions/setup-ruby@v1 | |
15 | with: | |
16 | version: 2.7 | |
17 | - name: Publish to RubyGems | |
18 | run: | | |
19 | mkdir -p $HOME/.gem | |
20 | touch $HOME/.gem/credentials | |
21 | chmod 0600 $HOME/.gem/credentials | |
22 | printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | |
23 | gem build *.gemspec | |
24 | gem push *.gem | |
25 | env: | |
26 | GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}} |
0 | name: Ruby | |
1 | ||
2 | on: | |
3 | push: | |
4 | branches: | |
5 | - master | |
6 | pull_request: | |
7 | branches: | |
8 | - master | |
9 | ||
10 | jobs: | |
11 | build: | |
12 | runs-on: ubuntu-latest | |
13 | strategy: | |
14 | matrix: | |
15 | ruby: | |
16 | - 2.5 | |
17 | - 2.6 | |
18 | - 2.7 | |
19 | name: Ruby ${{ matrix.ruby }} test | |
20 | steps: | |
21 | - uses: actions/checkout@v2 | |
22 | - name: Set up Ruby ${{ matrix.ruby }} | |
23 | uses: actions/setup-ruby@v1 | |
24 | with: | |
25 | ruby-version: ${{ matrix.ruby }} | |
26 | - name: Build and test with Rake | |
27 | run: | | |
28 | gem install bundler --no-document | |
29 | bundle install --jobs 4 --retry 3 | |
30 | bundle exec rake | |
31 | ||
32 | lint: | |
33 | runs-on: ubuntu-latest | |
34 | name: Rubocop lint | |
35 | steps: | |
36 | - uses: actions/checkout@v2 | |
37 | - name: Set up Ruby 2.5 | |
38 | uses: actions/setup-ruby@v1 | |
39 | with: | |
40 | ruby-version: 2.5 | |
41 | - name: Lint with Rubocop | |
42 | run: | | |
43 | gem install bundler --no-document | |
44 | bundle install --jobs 4 --retry 3 | |
45 | bundle exec rake rubocop |
0 | 0 | --- |
1 | 1 | inherit_from: .rubocop_todo.yml |
2 | 2 | |
3 | require: rubocop-performance | |
4 | ||
3 | 5 | AllCops: |
4 | TargetRubyVersion: 2.3 | |
6 | TargetRubyVersion: 2.5 | |
5 | 7 | |
6 | Metrics/LineLength: | |
7 | Max: 125 | |
8 | Layout/LineLength: | |
9 | Max: 123 | |
8 | 10 | Exclude: |
9 | 11 | - 'lib/gitlab/client/*' |
10 | 12 | - 'spec/**/*' |
21 | 23 | - 'lib/gitlab/*' |
22 | 24 | - 'lib/gitlab/client/*' |
23 | 25 | |
24 | Style/FrozenStringLiteralComment: | |
25 | Exclude: | |
26 | - 'spec/gitlab/file_response_spec.rb' | |
27 | - 'spec/gitlab/help_spec.rb' | |
26 | Lint/NonDeterministicRequireOrder: | |
27 | Enabled: false | |
28 | 28 | |
29 | Style/SpecialGlobalVars: | |
30 | Exclude: | |
31 | - 'gitlab.gemspec' | |
29 | Style/HashEachMethods: | |
30 | Enabled: true | |
31 | ||
32 | Style/HashTransformKeys: | |
33 | Enabled: true | |
34 | ||
35 | Style/HashTransformValues: | |
36 | Enabled: true |
0 | 0 | # This configuration was generated by |
1 | 1 | # `rubocop --auto-gen-config` |
2 | # on 2018-10-10 10:25:27 +0400 using RuboCop version 0.59.2. | |
2 | # on 2020-03-12 13:38:06 +0400 using RuboCop version 0.80.1. | |
3 | 3 | # The point is for the user to remove these configuration records |
4 | 4 | # one by one as the offenses are removed from the code base. |
5 | 5 | # Note that changes in the inspected code, or installation of new |
6 | 6 | # versions of RuboCop, may require this file to be generated again. |
7 | 7 | |
8 | # Offense count: 1 | |
9 | Lint/UriEscapeUnescape: | |
10 | Exclude: | |
11 | - 'lib/gitlab/client.rb' | |
12 | ||
13 | # Offense count: 5 | |
8 | # Offense count: 4 | |
14 | 9 | Metrics/AbcSize: |
15 | 10 | Max: 34 |
16 | 11 | |
17 | # Offense count: 4 | |
12 | # Offense count: 3 | |
18 | 13 | Metrics/CyclomaticComplexity: |
19 | Max: 14 | |
14 | Max: 12 | |
20 | 15 | |
21 | 16 | # Offense count: 10 |
22 | 17 | # Configuration parameters: CountComments, ExcludedMethods. |
26 | 21 | # Offense count: 2 |
27 | 22 | # Configuration parameters: CountComments. |
28 | 23 | Metrics/ModuleLength: |
29 | Max: 165 | |
24 | Max: 156 | |
30 | 25 | |
31 | 26 | # Offense count: 2 |
32 | 27 | # Configuration parameters: CountKeywordArgs. |
0 | 0 | --- |
1 | 1 | language: ruby |
2 | 2 | rvm: |
3 | - 2.3 | |
4 | - 2.4 | |
5 | 3 | - 2.5 |
6 | 4 | - 2.6 |
5 | - 2.7 | |
7 | 6 | |
8 | 7 | jobs: |
9 | 8 | include: |
10 | 9 | - stage: lint |
11 | rvm: 2.3 | |
10 | rvm: 2.5 | |
12 | 11 | script: bundle exec rake rubocop |
3 | 3 | |
4 | 4 | # Specify your gem's dependencies in gitlab.gemspec |
5 | 5 | gemspec |
6 | ||
7 | gem 'pry' | |
8 | gem 'rubocop' | |
9 | gem 'rubocop-performance' |
0 | Copyright (c) 2012-2019 Nihad Abbasov <nihad@42na.in> | |
0 | Copyright (c) 2012-2020 Nihad Abbasov <nihad@42na.in> | |
1 | 1 | All rights reserved. |
2 | 2 | |
3 | 3 | Redistribution and use in source and binary forms, with or without |
0 | 0 | # Gitlab |
1 | 1 | |
2 | [![Build Status](https://img.shields.io/travis/NARKOZ/gitlab.svg)](https://travis-ci.org/NARKOZ/gitlab) | |
2 | [![Build Status](https://img.shields.io/github/workflow/status/NARKOZ/gitlab/Ruby/master)](https://github.com/NARKOZ/gitlab/actions?query=workflow%3ARuby) | |
3 | 3 | [![Maintainability](https://api.codeclimate.com/v1/badges/2e310b334b1b5db4a7e1/maintainability)](https://codeclimate.com/github/NARKOZ/gitlab) |
4 | 4 | [![Inline docs](https://inch-ci.org/github/NARKOZ/gitlab.svg)](https://inch-ci.org/github/NARKOZ/gitlab) |
5 | 5 | [![Gem version](https://img.shields.io/gem/v/gitlab.svg)](https://rubygems.org/gems/gitlab) |
6 | 6 | [![License](https://img.shields.io/badge/license-BSD-red.svg)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt) |
7 | 7 | |
8 | 8 | [website](https://narkoz.github.io/gitlab) | |
9 | [documentation](https://rubydoc.info/gems/gitlab/frames) | | |
9 | [documentation](https://www.rubydoc.info/gems/gitlab/frames) | | |
10 | 10 | [gitlab-live](https://github.com/NARKOZ/gitlab-live) |
11 | 11 | |
12 | 12 | Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html). |
13 | As of version `4.0.0` this gem only supports Ruby 2.0+ and GitLab API v4. | |
13 | As of version `4.0.0` this gem only supports GitLab API v4. | |
14 | 14 | |
15 | 15 | ## Installation |
16 | 16 | |
39 | 39 | |
40 | 40 | ```ruby |
41 | 41 | Gitlab.configure do |config| |
42 | config.endpoint = 'https://example.net/api/v4' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] | |
42 | config.endpoint = 'https://example.net/api/v4' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] and falls back to ENV['CI_API_V4_URL'] | |
43 | 43 | config.private_token = 'qEsq1pt6HJPaNciie3MG' # user's private token or OAuth2 access token, default: ENV['GITLAB_API_PRIVATE_TOKEN'] |
44 | 44 | # Optional |
45 | 45 | # config.user_agent = 'Custom User Agent' # user agent, default: 'Gitlab Ruby Gem [version]' |
71 | 71 | Gitlab.projects(per_page: 5) |
72 | 72 | # => [#<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"}>] |
73 | 73 | |
74 | # initialize a new client | |
75 | g = Gitlab.client(endpoint: 'https://api.example.com', private_token: 'qEsq1pt6HJPaNciie3MG') | |
74 | # initialize a new client with custom headers | |
75 | g = Gitlab.client( | |
76 | endpoint: 'https://example.com/api/v4', | |
77 | private_token: 'qEsq1pt6HJPaNciie3MG', | |
78 | httparty: { | |
79 | headers: { 'Cookie' => 'gitlab_canary=true' } | |
80 | } | |
81 | ) | |
76 | 82 | # => #<Gitlab::Client:0x00000001e62408 @endpoint="https://api.example.com", @private_token="qEsq1pt6HJPaNciie3MG", @user_agent="Gitlab Ruby Gem 2.0.0"> |
77 | 83 | |
78 | 84 | # get a user |
109 | 115 | projects.auto_paginate |
110 | 116 | ``` |
111 | 117 | |
112 | For more information, refer to [documentation](https://rubydoc.info/gems/gitlab/frames). | |
118 | For more information, refer to [documentation](https://www.rubydoc.info/gems/gitlab/frames). | |
113 | 119 | |
114 | 120 | ## CLI |
115 | 121 | |
116 | 122 | 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: |
117 | 123 | ```sh |
118 | 124 | export GITLAB_API_ENDPOINT=https://gitlab.yourcompany.com/api/v4 |
119 | export GITLAB_API_PRIVATE_TOKEN=<your private token from /profile/account> | |
125 | export GITLAB_API_PRIVATE_TOKEN=<your private token from /profile/account or /profile/personal_access_tokens in newer version> | |
120 | 126 | # This one is optional and can be used to set any HTTParty option you may need |
121 | 127 | # using YAML hash syntax. For example, this is how you would disable SSL |
122 | 128 | # verification (useful if using a self-signed cert). |
0 | --- | |
0 | 1 | # For more information, see https://docs.gitlab.com/omnibus/docker/README.html#install-gitlab-using-docker-compose |
1 | 2 | version: '3' |
2 | 3 | services: |
7 | 7 | gem.name = 'gitlab' |
8 | 8 | gem.version = Gitlab::VERSION |
9 | 9 | gem.authors = ['Nihad Abbasov', 'Sean Edge'] |
10 | gem.email = ['mail@narkoz.me', 'asedge@gmail.com'] | |
10 | gem.email = ['nihad@42na.in', 'asedge@gmail.com'] | |
11 | 11 | gem.description = 'Ruby client and CLI for GitLab API' |
12 | 12 | gem.summary = 'A Ruby wrapper and CLI for the GitLab API' |
13 | gem.homepage = 'https://github.com/narkoz/gitlab' | |
13 | gem.homepage = 'https://github.com/NARKOZ/gitlab' | |
14 | 14 | |
15 | gem.files = `git ls-files`.split($/) | |
16 | .grep_v(/^spec/) - | |
17 | %w[Dockerfile docker-compose.yml docker.env .travis.yml | |
18 | .rubocop.yml .dockerignore] | |
15 | gem.files = Dir['{exe,lib}/**/*', 'LICENSE.txt', 'README.md', 'CHANGELOG.md'] | |
19 | 16 | gem.bindir = 'exe' |
20 | 17 | gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) } |
21 | 18 | gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) |
22 | 19 | gem.require_paths = ['lib'] |
23 | gem.license = 'BSD' | |
20 | gem.license = 'BSD-2-Clause' | |
24 | 21 | |
25 | gem.required_ruby_version = '>= 2.3' | |
22 | gem.required_ruby_version = '>= 2.5' | |
26 | 23 | |
27 | gem.add_runtime_dependency 'httparty', '>= 0.14.0' | |
28 | gem.add_runtime_dependency 'terminal-table', '>= 1.5.1' | |
24 | gem.add_runtime_dependency 'httparty', '~> 0.14', '>= 0.14.0' | |
25 | gem.add_runtime_dependency 'terminal-table', '~> 1.5', '>= 1.5.1' | |
29 | 26 | |
30 | gem.add_development_dependency 'pry' | |
31 | 27 | gem.add_development_dependency 'rake' |
32 | 28 | gem.add_development_dependency 'rspec' |
33 | gem.add_development_dependency 'rubocop' | |
34 | 29 | gem.add_development_dependency 'webmock' |
35 | 30 | end |
6 | 6 | |
7 | 7 | class Gitlab::CLI |
8 | 8 | extend Helpers |
9 | ||
10 | # If set to true, JSON will be rendered as output | |
11 | @render_json = false | |
12 | 9 | |
13 | 10 | # Starts a new CLI session. |
14 | 11 | # |
38 | 38 | # |
39 | 39 | # @return [Array] |
40 | 40 | def required_fields(args) |
41 | if args.any? && args.last.is_a?(String) && args.last.start_with?('--only=') | |
42 | args.last.gsub('--only=', '').split(',') | |
43 | else | |
44 | [] | |
45 | end | |
41 | filtered_fields(args, '--only=') | |
46 | 42 | end |
47 | 43 | |
48 | 44 | # Returns filtered excluded fields. |
49 | 45 | # |
50 | 46 | # @return [Array] |
51 | 47 | def excluded_fields(args) |
52 | if args.any? && args.last.is_a?(String) && args.last.start_with?('--except=') | |
53 | args.last.gsub('--except=', '').split(',') | |
54 | else | |
55 | [] | |
56 | end | |
48 | filtered_fields(args, '--except=') | |
49 | end | |
50 | ||
51 | # Returns fields filtered by a keyword. | |
52 | # | |
53 | # @return [Array] | |
54 | def filtered_fields(args, key) | |
55 | return [] unless args.any? && args.last.is_a?(String) && args.last.start_with?(key) | |
56 | ||
57 | args.last.gsub(key, '').split(',') | |
57 | 58 | end |
58 | 59 | |
59 | 60 | # Confirms command is valid. |
204 | 205 | |
205 | 206 | # Helper function to call Gitlab commands with args. |
206 | 207 | def gitlab_helper(cmd, args = []) |
207 | begin | |
208 | data = args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd) | |
209 | rescue StandardError => e | |
210 | puts e.message | |
211 | yield if block_given? | |
212 | end | |
213 | ||
214 | data | |
208 | args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd) | |
209 | rescue StandardError => e | |
210 | puts e.message | |
211 | yield if block_given? | |
215 | 212 | end |
216 | 213 | |
217 | 214 | # Convert a hash (recursively) to use symbol hash keys |
219 | 216 | def symbolize_keys(hash) |
220 | 217 | if hash.is_a?(Hash) |
221 | 218 | hash = hash.each_with_object({}) do |(key, value), new_hash| |
222 | begin | |
223 | new_hash[key.to_sym] = symbolize_keys(value) | |
224 | rescue NoMethodError | |
225 | raise "Error: cannot convert hash key to symbol: #{key}" | |
226 | end | |
219 | new_hash[key.to_sym] = symbolize_keys(value) | |
220 | rescue NoMethodError | |
221 | raise "Error: cannot convert hash key to symbol: #{key}" | |
227 | 222 | end |
228 | 223 | end |
229 | 224 |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to application settings. | |
4 | # @see https://docs.gitlab.com/ee/api/settings.html | |
5 | module ApplicationSettings | |
6 | # Retrives the application settings of Gitlab. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.application_settings | |
10 | # | |
11 | # @return [Array<Gitlab::ObjectifiedHash>] | |
12 | def application_settings | |
13 | get('/application/settings') | |
14 | end | |
15 | ||
16 | # Edit the applications settings of Gitlab. | |
17 | # | |
18 | # @example | |
19 | # Gitlab.edit_application_settings({ signup_enabled: false }) | |
20 | # | |
21 | # @param [Hash] options A customizable set of options. | |
22 | # @option options [String] :admin_notification_email | |
23 | # @option options [String] :after_sign_out_path | |
24 | # @option options [String] :after_sign_up_text | |
25 | # @option options [String] :akismet_api_key | |
26 | # @option options [Boolean] :akismet_enabled | |
27 | # @option options [Boolean] :allow_group_owners_to_manage_ldap | |
28 | # @option options [Boolean] :allow_local_requests_from_hooks_and_services | |
29 | # @option options [Boolean] :authorized_keys_enabled | |
30 | # @option options [String] :auto_devops_domain | |
31 | # @option options [Boolean] :auto_devops_enabled | |
32 | # @option options [Boolean] :check_namespace_plan | |
33 | # @option options [String] :clientside_sentry_dsn | |
34 | # @option options [Boolean] :clientside_sentry_enabled | |
35 | # @option options [Integer] :container_registry_token_expire_delay | |
36 | # @option options [String] :default_artifacts_expire_in | |
37 | # @option options [Integer] :default_branch_protection | |
38 | # @option options [String] :default_group_visibility | |
39 | # @option options [String] :default_project_visibility | |
40 | # @option options [Integer] :default_projects_limit | |
41 | # @option options [String] :default_snippet_visibility | |
42 | # @option options [Array<String>] :disabled_oauth_sign_in_sources | |
43 | # @option options [Array<String>] :domain_blacklist | |
44 | # @option options [Boolean] :domain_blacklist_enabled | |
45 | # @option options [Array<String>] :domain_whitelist | |
46 | # @option options [Integer] :dsa_key_restriction | |
47 | # @option options [Integer] :ecdsa_key_restriction | |
48 | # @option options [Integer] :ed25519_key_restriction | |
49 | # @option options [Boolean] :elasticsearch_aws | |
50 | # @option options [String] :elasticsearch_aws_access_key | |
51 | # @option options [String] :elasticsearch_aws_region | |
52 | # @option options [String] :elasticsearch_aws_secret_access_key | |
53 | # @option options [Boolean] :elasticsearch_experimental_indexer | |
54 | # @option options [Boolean] :elasticsearch_indexing | |
55 | # @option options [Boolean] :elasticsearch_search | |
56 | # @option options [String] :elasticsearch_url | |
57 | # @option options [Boolean] :elasticsearch_limit_indexing | |
58 | # @option options [Array<Integer>] :elasticsearch_project_ids | |
59 | # @option options [Array<Integer>] :elasticsearch_namespace_ids | |
60 | # @option options [String] :email_additional_text | |
61 | # @option options [Boolean] :email_author_in_body | |
62 | # @option options [String] :enabled_git_access_protocol | |
63 | # @option options [Boolean] :enforce_terms | |
64 | # @option options [String] :external_auth_client_cert | |
65 | # @option options [String] :external_auth_client_key | |
66 | # @option options [String] :external_auth_client_key_pass | |
67 | # @option options [Boolean] :external_authorization_service_enabled | |
68 | # @option options [String] :external_authorization_service_default_label | |
69 | # @option options [Float] :external_authorization_service_timeout float | |
70 | # @option options [String] :external_authorization_service_url | |
71 | # @option options [Integer] :file_template_project_id | |
72 | # @option options [Integer] :first_day_of_week | |
73 | # @option options [Integer] :geo_status_timeout | |
74 | # @option options [Integer] :gitaly_timeout_default | |
75 | # @option options [Integer] :gitaly_timeout_fast | |
76 | # @option options [Integer] :gitaly_timeout_medium | |
77 | # @option options [Boolean] :gravatar_enabled | |
78 | # @option options [Boolean] :hashed_storage_enabled | |
79 | # @option options [Boolean] :help_page_hide_commercial_content | |
80 | # @option options [String] :help_page_support_url | |
81 | # @option options [String] :help_page_text | |
82 | # @option options [String] :help_text | |
83 | # @option options [Boolean] :hide_third_party_offers | |
84 | # @option options [String] :home_page_url | |
85 | # @option options [Boolean] :housekeeping_bitmaps_enabled | |
86 | # @option options [Boolean] :housekeeping_enabled | |
87 | # @option options [Integer] :housekeeping_full_repack_period | |
88 | # @option options [Integer] :housekeeping_gc_period | |
89 | # @option options [Integer] :housekeeping_incremental_repack_period | |
90 | # @option options [Boolean] :html_emails_enabled | |
91 | # @option options [Boolean] :instance_statistics_visibility_private | |
92 | # @option options [Array<String>] :import_sources | |
93 | # @option options [Integer] :max_artifacts_size | |
94 | # @option options [Integer] :max_attachment_size | |
95 | # @option options [Integer] :max_pages_size | |
96 | # @option options [Boolean] :metrics_enabled | |
97 | # @option options [String] :metrics_host | |
98 | # @option options [Integer] :metrics_method_call_threshold | |
99 | # @option options [Integer] :metrics_packet_size | |
100 | # @option options [Integer] :metrics_pool_size | |
101 | # @option options [Integer] :metrics_port | |
102 | # @option options [Integer] :metrics_sample_interval | |
103 | # @option options [Integer] :metrics_timeout | |
104 | # @option options [Boolean] :mirror_available | |
105 | # @option options [Integer] :mirror_capacity_threshold | |
106 | # @option options [Integer] :mirror_max_capacity | |
107 | # @option options [Integer] :mirror_max_delay | |
108 | # @option options [Boolean] :pages_domain_verification_enabled | |
109 | # @option options [Boolean] :password_authentication_enabled_for_git | |
110 | # @option options [Boolean] :password_authentication_enabled_for_web | |
111 | # @option options [String] :performance_bar_allowed_group_id | |
112 | # @option options [String] :performance_bar_allowed_group_path | |
113 | # @option options [Boolean] :performance_bar_enabled | |
114 | # @option options [Boolean] :plantuml_enabled | |
115 | # @option options [String] :plantuml_url | |
116 | # @option options [Float] :polling_interval_multiplier | |
117 | # @option options [Boolean] :project_export_enabled | |
118 | # @option options [Boolean] :prometheus_metrics_enabled | |
119 | # @option options [Boolean] :pseudonymizer_enabled | |
120 | # @option options [Boolean] :recaptcha_enabled | |
121 | # @option options [String] :recaptcha_private_key | |
122 | # @option options [String] :recaptcha_site_key | |
123 | # @option options [Boolean] :repository_checks_enabled | |
124 | # @option options [Integer] :repository_size_limit | |
125 | # @option options [Array<String>] :repository_storages | |
126 | # @option options [Boolean] :require_two_factor_authentication | |
127 | # @option options [Array<String>] :restricted_visibility_levels | |
128 | # @option options [Integer] :rsa_key_restriction | |
129 | # @option options [Boolean] :send_user_confirmation_email | |
130 | # @option options [String] :sentry_dsn | |
131 | # @option options [Boolean] :sentry_enabled | |
132 | # @option options [Integer] :session_expire_delay | |
133 | # @option options [Boolean] :shared_runners_enabled | |
134 | # @option options [Integer] :shared_runners_minutes | |
135 | # @option options [String] :shared_runners_text | |
136 | # @option options [String] :sign_in_text | |
137 | # @option options [String] :signin_enabled | |
138 | # @option options [Boolean] :signup_enabled | |
139 | # @option options [Boolean] :slack_app_enabled | |
140 | # @option options [String] :slack_app_id | |
141 | # @option options [String] :slack_app_secret | |
142 | # @option options [String] :slack_app_verification_token | |
143 | # @option options [Integer] :terminal_max_session_time | |
144 | # @option options [String] :terms | |
145 | # @option options [Boolean] :throttle_authenticated_api_enabled | |
146 | # @option options [Integer] :throttle_authenticated_api_period_in_seconds | |
147 | # @option options [Integer] :throttle_authenticated_api_requests_per_period | |
148 | # @option options [Boolean] :throttle_authenticated_web_enabled | |
149 | # @option options [Integer] :throttle_authenticated_web_period_in_seconds | |
150 | # @option options [Integer] :throttle_authenticated_web_requests_per_period | |
151 | # @option options [Boolean] :throttle_unauthenticated_enabled | |
152 | # @option options [Integer] :throttle_unauthenticated_period_in_seconds | |
153 | # @option options [Integer] :throttle_unauthenticated_requests_per_period | |
154 | # @option options [Integer] :two_factor_grace_period | |
155 | # @option options [Boolean] :unique_ips_limit_enabled | |
156 | # @option options [Integer] :unique_ips_limit_per_user | |
157 | # @option options [Integer] :unique_ips_limit_time_window | |
158 | # @option options [Boolean] :usage_ping_enabled | |
159 | # @option options [Boolean] :user_default_external | |
160 | # @option options [Boolean] :user_oauth_applications | |
161 | # @option options [Boolean] :user_show_add_ssh_key_message | |
162 | # @option options [Boolean] :version_check_enabled | |
163 | # @option options [Integer] :local_markdown_version | |
164 | # @option options [String] :geo_node_allowed_ips | |
165 | # | |
166 | # @return [Array<Gitlab::ObjectifiedHash>] | |
167 | def edit_application_settings(options = {}) | |
168 | put('/application/settings', body: options) | |
169 | end | |
170 | end | |
171 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to avatar. | |
4 | # @see https://docs.gitlab.com/ce/api/avatar.html | |
5 | module Avatar | |
6 | # Get a single avatar URL for a user with the given email address. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.avatar(email: 'admin@example.com') | |
10 | # Gitlab.avatar(email: 'admin@example.com', size: 32) | |
11 | # | |
12 | # @param [Hash] options A customizable set of options. | |
13 | # @option options [String] :email(required) Public email address of the user. | |
14 | # @option options [Integer] :size(optional) Single pixel dimension (since images are squares). Only used for avatar lookups at Gravatar or at the configured Libravatar server. | |
15 | # @return <Gitlab::ObjectifiedHash> | |
16 | def avatar(options = {}) | |
17 | get('/avatar', query: options) | |
18 | end | |
19 | end | |
20 | end |
16 | 16 | # @return [Array<Gitlab::ObjectifiedHash>] |
17 | 17 | def boards(project, options = {}) |
18 | 18 | get("/projects/#{url_encode project}/boards", query: options) |
19 | end | |
20 | ||
21 | # Get a single board. | |
22 | # | |
23 | # @example | |
24 | # Gitlab.board(5, 1) | |
25 | # | |
26 | # @param [Integer, String] project The ID or name of a project. | |
27 | # @param [Integer] id The ID of a board. | |
28 | # @return [Gitlab::ObjectifiedHash] Returns information about the board | |
29 | def board(project, id) | |
30 | get("/projects/#{url_encode project}/boards/#{id}") | |
31 | end | |
32 | ||
33 | # Creates a new board. | |
34 | # | |
35 | # @example | |
36 | # Gitlab.create_board(5, 'newboard') | |
37 | # | |
38 | # @param [Integer, String] project The ID or name of a project. | |
39 | # @param [String] name The name of the new board. | |
40 | # @return [Gitlab::ObjectifiedHash] Information about created board. | |
41 | def create_board(project, name) | |
42 | body = { name: name } | |
43 | post("/projects/#{url_encode project}/boards", body: body) | |
44 | end | |
45 | ||
46 | # Updates a board. | |
47 | # | |
48 | # @example | |
49 | # Gitlab.edit_board(5, 1, name: 'new_name') | |
50 | # Gitlab.edit_board(5, 1, name: 'new_name', assignee_id: 1, milestone_id: 1) | |
51 | # | |
52 | # @param [Integer, String] project The ID or name of a project. | |
53 | # @param [Integer] id The ID of a board. | |
54 | # @param [Hash] options A customizable set of options. | |
55 | # @option options [String] :name(optional) The new name of the board. | |
56 | # @option options [Integer] :assignee_id(optional) The assignee the board should be scoped to. | |
57 | # @option options [Integer] :milestone_id(optional) The milestone the board should be scoped to. | |
58 | # @option options [String] :labels(optional) Comma-separated list of label names which the board should be scoped to. | |
59 | # @option options [Integer] :weight(optional) The weight range from 0 to 9, to which the board should be scoped to. | |
60 | # @return [Gitlab::ObjectifiedHash] Information about updated board. | |
61 | def edit_board(project, id, options = {}) | |
62 | put("/projects/#{url_encode project}/boards/#{id}", body: options) | |
63 | end | |
64 | ||
65 | # Deletes a board. | |
66 | # | |
67 | # @example | |
68 | # Gitlab.delete_board(5, 1) | |
69 | # | |
70 | # @param [Integer, String] project The ID or name of a project. | |
71 | # @param [Integer] id The ID of a board. | |
72 | # @return [void] This API call returns an empty response body. | |
73 | def delete_board(project, id) | |
74 | delete("/projects/#{url_encode project}/boards/#{id}") | |
19 | 75 | end |
20 | 76 | |
21 | 77 | # Gets a board lists |
1 | 1 | |
2 | 2 | class Gitlab::Client |
3 | 3 | # Defines methods related to builds. |
4 | # @see https://docs.gitlab.com/ce/api/build_variables.html | |
5 | # @see https://docs.gitlab.com/ee/api/group_level_variables.html | |
4 | # @see https://docs.gitlab.com/ce/api/project_level_variables.html | |
5 | # @see https://docs.gitlab.com/ce/api/group_level_variables.html | |
6 | 6 | module BuildVariables |
7 | 7 | # Gets a list of the project's build variables |
8 | 8 | # |
35 | 35 | # @param [Integer, String] project The ID or name of a project. |
36 | 36 | # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed |
37 | 37 | # @param [String] value The value of a variable |
38 | # @param [Hash] opts optional parameters | |
38 | 39 | # @return [Gitlab::ObjectifiedHash] The variable. |
39 | def create_variable(project, key, value) | |
40 | post("/projects/#{url_encode project}/variables", body: { key: key, value: value }) | |
40 | def create_variable(project, key, value, **opts) | |
41 | post("/projects/#{url_encode project}/variables", body: opts.merge(key: key, value: value)) | |
41 | 42 | end |
42 | 43 | |
43 | 44 | # Update a project's build variable. |
48 | 49 | # @param [Integer, String] project The ID or name of a project. |
49 | 50 | # @param [String] key The key of a variable |
50 | 51 | # @param [String] value The value of a variable |
52 | # @param [Hash] opts optional parameters | |
51 | 53 | # @return [Gitlab::ObjectifiedHash] The variable. |
52 | def update_variable(project, key, value) | |
53 | put("/projects/#{url_encode project}/variables/#{key}", body: { value: value }) | |
54 | def update_variable(project, key, value, **opts) | |
55 | put("/projects/#{url_encode project}/variables/#{key}", body: opts.merge(value: value)) | |
54 | 56 | end |
55 | 57 | |
56 | 58 | # Remove a project's build variable. |
96 | 98 | # @param [Integer, String] group The ID or name of a group. |
97 | 99 | # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed |
98 | 100 | # @param [String] value The value of a variable |
101 | # @param [Hash] opts optional parameters | |
99 | 102 | # @return [Gitlab::ObjectifiedHash] The variable. |
100 | def create_group_variable(group, key, value) | |
101 | post("/groups/#{url_encode group}/variables", body: { key: key, value: value }) | |
103 | def create_group_variable(group, key, value, **opts) | |
104 | post("/groups/#{url_encode group}/variables", body: opts.merge(key: key, value: value)) | |
102 | 105 | end |
103 | 106 | |
104 | 107 | # Update a group's build variable. |
109 | 112 | # @param [Integer, String] group The ID or name of a group. |
110 | 113 | # @param [String] key The key of a variable |
111 | 114 | # @param [String] value The value of a variable |
115 | # @param [Hash] opts optional parameters | |
112 | 116 | # @return [Gitlab::ObjectifiedHash] The variable. |
113 | def update_group_variable(group, key, value) | |
114 | put("/groups/#{url_encode group}/variables/#{key}", body: { value: value }) | |
117 | def update_group_variable(group, key, value, **opts) | |
118 | put("/groups/#{url_encode group}/variables/#{key}", body: opts.merge(value: value)) | |
115 | 119 | end |
116 | 120 | |
117 | 121 | # Remove a group's build variable. |
7 | 7 | # |
8 | 8 | # @example |
9 | 9 | # Gitlab.commits('viking') |
10 | # Gitlab.repo_commits('gitlab', { ref_name: 'api' }) | |
10 | # Gitlab.repo_commits('gitlab', { ref: 'api' }) | |
11 | 11 | # |
12 | 12 | # @param [Integer, String] project The ID or name of a project. |
13 | 13 | # @param [Hash] options A customizable set of options. |
14 | # @option options [String] :ref_name The branch or tag name of a project repository. | |
14 | # @option options [String] :ref The branch or tag name of a project repository. | |
15 | 15 | # @option options [Integer] :page The page number. |
16 | 16 | # @option options [Integer] :per_page The number of results per page. |
17 | 17 | # @return [Array<Gitlab::ObjectifiedHash>] |
33 | 33 | get("/projects/#{url_encode project}/repository/commits/#{sha}") |
34 | 34 | end |
35 | 35 | alias repo_commit commit |
36 | ||
37 | # Get all references (from branches or tags) a commit is pushed to. | |
38 | # | |
39 | # @example | |
40 | # Gitlab.commit_refs(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6') | |
41 | # | |
42 | # @param [Integer, String] project The ID or name of a project. | |
43 | # @param [String] sha The commit hash | |
44 | # @param [Hash] options A customizable set of options. | |
45 | # @option options [String] :type The scope of commits. Possible values `branch`, `tag`, `all`. Default is `all`. | |
46 | # @option options [Integer] :page The page number. | |
47 | # @option options [Integer] :per_page The number of results per page. | |
48 | # @return [Gitlab::ObjectifiedHash] | |
49 | def commit_refs(project, sha, options = {}) | |
50 | get("/projects/#{url_encode project}/repository/commits/#{sha}/refs", query: options) | |
51 | end | |
36 | 52 | |
37 | 53 | # Cherry picks a commit to a given branch. |
38 | 54 | # |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to GitLab Container Registry. | |
4 | # @see https://docs.gitlab.com/ce/api/container_registry.html | |
5 | module ContainerRegistry | |
6 | # Get a list of registry repositories in a project. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.registry_repositories(5) | |
10 | # | |
11 | # @param [Integer, String] project The ID or name of a project. | |
12 | # @return [Array<Gitlab::ObjectifiedHash>] Returns list of registry repositories in a project. | |
13 | def registry_repositories(project) | |
14 | get("/projects/#{url_encode project}/registry/repositories") | |
15 | end | |
16 | ||
17 | # Delete a repository in registry. | |
18 | # | |
19 | # @example | |
20 | # Gitlab.delete_registry_repository(5, 2) | |
21 | # | |
22 | # @param [Integer, String] project The ID or name of a project. | |
23 | # @param [Integer] id The ID of registry repository. | |
24 | # @return [void] This API call returns an empty response body. | |
25 | def delete_registry_repository(project, id) | |
26 | delete("/projects/#{url_encode project}/registry/repositories/#{id}") | |
27 | end | |
28 | ||
29 | # Get a list of tags for given registry repository. | |
30 | # | |
31 | # @example | |
32 | # Gitlab.registry_repository_tags(5, 2) | |
33 | # | |
34 | # @param [Integer, String] project The ID or name of a project. | |
35 | # @param [Integer] repository_id The ID of registry repository. | |
36 | # @return [Array<Gitlab::ObjectifiedHash>] Returns list of tags of a registry repository. | |
37 | def registry_repository_tags(project, repository_id) | |
38 | get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags") | |
39 | end | |
40 | ||
41 | # Get details of a registry repository tag. | |
42 | # | |
43 | # @example | |
44 | # Gitlab.registry_repository_tag(5, 2, 'v10.0.0') | |
45 | # | |
46 | # @param [Integer, String] project The ID or name of a project. | |
47 | # @param [Integer] repository_id The ID of registry repository. | |
48 | # @param [String] tag_name The name of tag. | |
49 | # @return <Gitlab::ObjectifiedHash> Returns details about the registry repository tag | |
50 | def registry_repository_tag(project, repository_id, tag_name) | |
51 | get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}") | |
52 | end | |
53 | ||
54 | # Delete a registry repository tag. | |
55 | # | |
56 | # @example | |
57 | # Gitlab.delete_registry_repository_tag(5, 2, 'v10.0.0') | |
58 | # | |
59 | # @param [Integer, String] project The ID or name of a project. | |
60 | # @param [Integer] repository_id The ID of registry repository. | |
61 | # @param [String] tag_name The name of tag. | |
62 | # @return [void] This API call returns an empty response body. | |
63 | def delete_registry_repository_tag(project, repository_id, tag_name) | |
64 | delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}") | |
65 | end | |
66 | ||
67 | # Delete repository tags in bulk based on given criteria. | |
68 | # | |
69 | # @example | |
70 | # Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '.*') | |
71 | # Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '[0-9a-z]{40}', keep_n: 5, older_than: '1d') | |
72 | # | |
73 | # @param [Integer, String] project The ID or name of a project. | |
74 | # @param [Integer] repository_id The ID of registry repository. | |
75 | # @param [Hash] options A customizable set of options. | |
76 | # @option options [String] :name_regex(required) The regex of the name to delete. To delete all tags specify .*. | |
77 | # @option options [Integer] :keep_n(optional) The amount of latest tags of given name to keep. | |
78 | # @option options [String] :older_than(required) Tags to delete that are older than the given time, written in human readable form 1h, 1d, 1month. | |
79 | # @return [void] This API call returns an empty response body. | |
80 | def bulk_delete_registry_repository_tags(project, repository_id, options = {}) | |
81 | delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags", query: options) | |
82 | end | |
83 | end | |
84 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to Epics. | |
4 | # @see https://docs.gitlab.com/ee/api/epics.html | |
5 | module Epics | |
6 | # Gets a list of epics. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.epics(123) | |
10 | # Gitlab.epics(123, { per_page: 40, page: 2 }) | |
11 | # | |
12 | # @param [Integer] group_id The ID of a group. | |
13 | # @param [Hash] options A customizable set of options. | |
14 | # @option options [Integer] :page The page number. | |
15 | # @option options [Integer] :per_page The number of results per page. | |
16 | # @return [Array<Gitlab::ObjectifiedHash>] | |
17 | def epics(group_id, options = {}) | |
18 | get("/groups/#{group_id}/epics", query: options) | |
19 | end | |
20 | ||
21 | # Gets a single epic. | |
22 | # | |
23 | # @example | |
24 | # Gitlab.epic(123, 1) | |
25 | # | |
26 | # @param [Integer] group_id The ID of a group. | |
27 | # @param [Integer] epic_iid The ID of a epic. | |
28 | # @param [Hash] options A customizable set of options. | |
29 | # @return [Gitlab::ObjectifiedHash] | |
30 | def epic(group_id, epic_iid, options = {}) | |
31 | get("/groups/#{group_id}/epics/#{epic_iid}", query: options) | |
32 | end | |
33 | ||
34 | # Creates a new epic. | |
35 | # | |
36 | # @example | |
37 | # Gitlab.create_epic(123, "My new epic title") | |
38 | # | |
39 | # @param [Integer] group_id The ID of a group. | |
40 | # @param [String] title | |
41 | # @param [Hash] options A customizable set of options. | |
42 | # @return [Gitlab::ObjectifiedHash] Information about created epic. | |
43 | def create_epic(group_id, title, options = {}) | |
44 | body = options.merge(title: title) | |
45 | post("/groups/#{group_id}/epics", body: body) | |
46 | end | |
47 | ||
48 | # Deletes an epic. | |
49 | # | |
50 | # @example | |
51 | # Gitlab.delete_epic(42, 123) | |
52 | # @param [Integer] group_id The ID of a group. | |
53 | # @param [Integer] epic_iid The IID of an epic. | |
54 | def delete_epic(group_id, epic_iid) | |
55 | delete("/groups/#{group_id}/epics/#{epic_iid}") | |
56 | end | |
57 | ||
58 | # Updates an existing epic. | |
59 | # | |
60 | # @example | |
61 | # Gitlab.edit_epic(42) | |
62 | # Gitlab.edit_epic(42, 123, { title: 'New epic title' }) | |
63 | # | |
64 | # @param [Integer] group_id The ID. | |
65 | # @param [Integer] epic_iid The IID of an epic. | |
66 | # @param [Hash] options A customizable set of options | |
67 | # @return [Gitlab::ObjectifiedHash] Information about the edited epic. | |
68 | def edit_epic(group_id, epic_iid, options = {}) | |
69 | put("/groups/#{group_id}/epics/#{epic_iid}", body: options) | |
70 | end | |
71 | end | |
72 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to feature flags. | |
4 | # https://docs.gitlab.com/ce/api/features.html | |
5 | module Features | |
6 | # Get a list of all persisted features, with its gate values. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.features | |
10 | # | |
11 | # @return [Array<Gitlab::ObjectifiedHash>] | |
12 | def features | |
13 | get('/features') | |
14 | end | |
15 | ||
16 | # Set a features gate value. | |
17 | # If a feature with the given name does not exist yet it will be created. The value can be a boolean, or an integer to indicate percentage of time. | |
18 | # | |
19 | # @example | |
20 | # Gitlab.set_feature('new_library', true) | |
21 | # Gitlab.set_feature('new_library', 8) | |
22 | # Gitlab.set_feature('new_library', true, {user: 'gitlab'}) | |
23 | # | |
24 | # @param [String] name(required) Name of the feature to create or update | |
25 | # @param [String, Integer] value(required) true or false to enable/disable, or an integer for percentage of time | |
26 | # @param [Hash] options A customizable set of options. | |
27 | # @option options [String] :feature_group(optional) A Feature group name | |
28 | # @option options [String] :user(optional) A GitLab username | |
29 | # @option options [String] :project(optional) A projects path, for example "gitlab-org/gitlab-ce" | |
30 | # @return [Gitlab::ObjectifiedHash] Information about the set/created/updated feature. | |
31 | def set_feature(name, value, options = {}) | |
32 | body = { value: value }.merge(options) | |
33 | post("/features/#{name}", body: body) | |
34 | end | |
35 | ||
36 | # Delete a feature. | |
37 | # | |
38 | # @example | |
39 | # Gitlab.delete_feature('new_library') | |
40 | # | |
41 | # @param [String] name Name of the feature to delete | |
42 | # @return [void] This API call returns an empty response body. | |
43 | def delete_feature(name) | |
44 | delete("/features/#{name}") | |
45 | end | |
46 | end | |
47 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to group issue boards. | |
4 | # @see https://docs.gitlab.com/ee/api/group_boards.html | |
5 | module GroupBoards | |
6 | # Lists Issue Boards in the given group. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.group_boards(5) | |
10 | # | |
11 | # @param [Integer, String] group The ID or name of a group. | |
12 | # @return [Array<Gitlab::ObjectifiedHash>] List of issue boards of the group | |
13 | def group_boards(group) | |
14 | get("/groups/#{url_encode group}/boards") | |
15 | end | |
16 | ||
17 | # Gets a single group issue board. | |
18 | # | |
19 | # @example | |
20 | # Gitlab.group_board(5, 1) | |
21 | # | |
22 | # @param [Integer, String] group The ID or name of a group. | |
23 | # @param [Integer] id The ID of the issue board. | |
24 | # @return [Gitlab::ObjectifiedHash] Returns information about a group issue board | |
25 | def group_board(group, id) | |
26 | get("/groups/#{url_encode group}/boards/#{id}") | |
27 | end | |
28 | ||
29 | # Creates a new group issue board. | |
30 | # | |
31 | # @example | |
32 | # Gitlab.create_group_board(5, 'Documentcloud') | |
33 | # | |
34 | # @param [Integer, String] group The ID or name of a group. | |
35 | # @param [String] name The name of the new board. | |
36 | # @return [Gitlab::ObjectifiedHash] Information about created group issue board. | |
37 | def create_group_board(group, name) | |
38 | body = { name: name } | |
39 | post("/groups/#{url_encode group}/boards", body: body) | |
40 | end | |
41 | ||
42 | # Updates a group issue board. | |
43 | # | |
44 | # @example | |
45 | # Gitlab.edit_group_board(5, 1, { name: 'DocumentCloud2' }) | |
46 | # Gitlab.edit_group_board(5, 1, { name: 'DocumentCloud2', assignee_id: 3 }) | |
47 | # | |
48 | # @param [Integer, String] group The ID or name of a group. | |
49 | # @param [Integer] id The ID of the issue board. | |
50 | # @param [Hash] options A customizable set of options. | |
51 | # @option options [String] :name(optional) The new name of the board. | |
52 | # @option options [Integer] :assignee_id(optional) The assignee the board should be scoped to. | |
53 | # @option options [Integer] :milestone_id(optional) The milestone the board should be scoped to. | |
54 | # @option options [String] :labels(optional) Comma-separated list of label names which the board should be scoped to. | |
55 | # @option options [Integer] :weight(optional) The weight range from 0 to 9, to which the board should be scoped to. | |
56 | # @return [Gitlab::ObjectifiedHash] Information about updated group issue board. | |
57 | def edit_group_board(group, id, options = {}) | |
58 | put("/groups/#{url_encode group}/boards/#{id}", body: options) | |
59 | end | |
60 | ||
61 | # Deletes a group issue board. | |
62 | # | |
63 | # @example | |
64 | # Gitlab.delete_group_board(5, 1) | |
65 | # | |
66 | # @param [Integer, String] group The ID or name of a group. | |
67 | # @param [Integer] id The ID of the issue board. | |
68 | # @return [void] This API call returns an empty response body. | |
69 | def delete_group_board(group, id) | |
70 | delete("/groups/#{url_encode group}/boards/#{id}") | |
71 | end | |
72 | ||
73 | # Get a list of the boards lists. Does not include open and closed lists | |
74 | # | |
75 | # @example | |
76 | # Gitlab.group_board_lists(5, 1) | |
77 | # | |
78 | # @param [Integer, String] group The ID or name of a group. | |
79 | # @param [Integer] board_id The ID of the group issue board. | |
80 | # @return [Array<Gitlab::ObjectifiedHash>] List of boards lists of the group | |
81 | def group_board_lists(group, board_id) | |
82 | get("/groups/#{url_encode group}/boards/#{board_id}/lists") | |
83 | end | |
84 | ||
85 | # Get a single group issue board list. | |
86 | # | |
87 | # @example | |
88 | # Gitlab.group_board_list(5, 1, 1) | |
89 | # | |
90 | # @param [Integer, String] group The ID or name of a group. | |
91 | # @param [Integer] board_id The ID of the group issue board. | |
92 | # @param [Integer] list_id The ID of a boards list. | |
93 | # @return [Gitlab::ObjectifiedHash] Returns information about a single group issue board list | |
94 | def group_board_list(group, board_id, id) | |
95 | get("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}") | |
96 | end | |
97 | ||
98 | # Creates a new group issue board list. | |
99 | # | |
100 | # @example | |
101 | # Gitlab.create_group_board_list(5, 1) | |
102 | # | |
103 | # @param [Integer, String] group The ID or name of a group. | |
104 | # @param [Integer] board_id The ID of the group issue board. | |
105 | # @param [Integer] label_id The ID of a label. | |
106 | # @return [Gitlab::ObjectifiedHash] Information about created group issue board list. | |
107 | def create_group_board_list(group, board_id, label_id) | |
108 | body = { label_id: label_id } | |
109 | post("/groups/#{url_encode group}/boards/#{board_id}/lists", body: body) | |
110 | end | |
111 | ||
112 | # Updates an existing group issue board list. This call is used to change list position. | |
113 | # | |
114 | # @example | |
115 | # Gitlab.edit_group_board_list(5, 1, 1, { position: 1 }) | |
116 | # | |
117 | # @param [Integer, String] group The ID or name of a group. | |
118 | # @param [Integer] board_id The ID of the group issue board. | |
119 | # @param [Integer] list_id The ID of a boards list. | |
120 | # @param [Hash] options A customizable set of options. | |
121 | # @option options [String] :position(required) The position of the list. | |
122 | # @return [Gitlab::ObjectifiedHash] Information about updated group issue board list. | |
123 | def edit_group_board_list(group, board_id, id, options = {}) | |
124 | put("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}", body: options) | |
125 | end | |
126 | ||
127 | # Deletes a group issue board list. | |
128 | # | |
129 | # @example | |
130 | # Gitlab.delete_group_board_list(5, 1, 1) | |
131 | # | |
132 | # @param [Integer, String] group The ID or name of a group. | |
133 | # @param [Integer] board_id The ID of the group issue board. | |
134 | # @param [Integer] list_id The ID of a boards list. | |
135 | # @return [void] This API call returns an empty response body. | |
136 | def delete_group_board_list(group, board_id, id) | |
137 | delete("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}") | |
138 | end | |
139 | end | |
140 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to group labels. | |
4 | # | |
5 | # @note Requires GitLab 11.8+ | |
6 | # @see https://docs.gitlab.com/ee/api/group_labels.html | |
7 | module GroupLabels | |
8 | # Gets a list of group's labels. | |
9 | # | |
10 | # @example | |
11 | # Gitlab.group_labels('globex') | |
12 | # | |
13 | # @param [Integer, String] group The ID or name of a group. | |
14 | # @return [Array<Gitlab::ObjectifiedHash>] | |
15 | def group_labels(group, options = {}) | |
16 | get("/groups/#{url_encode group}/labels", query: options) | |
17 | end | |
18 | ||
19 | # Creates a new group label. | |
20 | # | |
21 | # @example | |
22 | # Gitlab.create_group_label('globex', 'Backlog', '#DD10AA') | |
23 | # | |
24 | # @param [Integer, String] group The ID or name of a group. | |
25 | # @param [String] name The name of a label. | |
26 | # @param [String] color The color of a label. | |
27 | # @param [Hash] options A customizable set of options. | |
28 | # @option options [String] :description The description of the label. | |
29 | # @return [Gitlab::ObjectifiedHash] Information about created label. | |
30 | def create_group_label(group, name, color, options = {}) | |
31 | post("/groups/#{url_encode group}/labels", body: options.merge(name: name, color: color)) | |
32 | end | |
33 | ||
34 | # Updates a group label. | |
35 | # | |
36 | # @example | |
37 | # Gitlab.edit_group_label('globex', 'Backlog', { new_name: 'Priority' }) | |
38 | # Gitlab.edit_group_label('globex', 'Backlog', { new_name: 'Priority', color: '#DD10AA' }) | |
39 | # | |
40 | # @param [Integer, String] group The ID or name of a group. | |
41 | # @param [String] name The name of a label. | |
42 | # @param [Hash] options A customizable set of options. | |
43 | # @option options [String] :new_name The new name of a label. | |
44 | # @option options [String] :color The color of a label. | |
45 | # @option options [String] :description The description of the label. | |
46 | # @return [Gitlab::ObjectifiedHash] Information about updated label. | |
47 | def edit_group_label(group, name, options = {}) | |
48 | put("/groups/#{url_encode group}/labels", body: options.merge(name: name)) | |
49 | end | |
50 | ||
51 | # Deletes a group label. | |
52 | # | |
53 | # @example | |
54 | # Gitlab.delete_group_label('globex', 'Backlog') | |
55 | # | |
56 | # @param [Integer, String] group The ID or name of a group. | |
57 | # @param [String] name The name of a label. | |
58 | # @return [Gitlab::ObjectifiedHash] Information about deleted label. | |
59 | def delete_group_label(group, name) | |
60 | delete("/groups/#{url_encode group}/labels", body: { name: name }) | |
61 | end | |
62 | ||
63 | # Subscribes the user to a group label to receive notifications | |
64 | # | |
65 | # @example | |
66 | # Gitlab.subscribe_to_group_label('globex', 'Backlog') | |
67 | # | |
68 | # @param [Integer, String] group The ID or name of a group. | |
69 | # @param [String] name The name of a label. | |
70 | # @return [Gitlab::ObjectifiedHash] Information about the label subscribed to. | |
71 | def subscribe_to_group_label(group, name) | |
72 | post("/groups/#{url_encode group}/labels/#{url_encode name}/subscribe") | |
73 | end | |
74 | ||
75 | # Unsubscribes the user from a group label to not receive notifications from it | |
76 | # | |
77 | # @example | |
78 | # Gitlab.unsubscribe_from_group_label('globex', 'Backlog') | |
79 | # | |
80 | # @param [Integer, String] group The ID or name of a group. | |
81 | # @param [String] name The name of a label. | |
82 | # @return [Gitlab::ObjectifiedHash] Information about the label unsubscribed from. | |
83 | def unsubscribe_from_group_label(group, name) | |
84 | post("/groups/#{url_encode group}/labels/#{url_encode name}/unsubscribe") | |
85 | end | |
86 | end | |
87 | end |
23 | 23 | # Gitlab.group(42) |
24 | 24 | # |
25 | 25 | # @param [Integer] id The ID of a group. |
26 | # @param [Hash] options A customizable set of options. | |
27 | # @option options [Boolean] :with_custom_attributes Include custom attributes in response (admins only) | |
28 | # @option options [Boolean] :with_projects Include details about group projects (default: true) | |
26 | 29 | # @return [Gitlab::ObjectifiedHash] |
27 | def group(id) | |
28 | get("/groups/#{url_encode id}") | |
30 | def group(id, options = {}) | |
31 | get("/groups/#{url_encode id}", query: options) | |
29 | 32 | end |
30 | 33 | |
31 | 34 | # Creates a new group. |
77 | 80 | # @return [Gitlab::ObjectifiedHash] (id, username, name, email, state, access_level ...) |
78 | 81 | def group_member(team_id, user_id) |
79 | 82 | get("/groups/#{url_encode team_id}/members/#{user_id}") |
83 | end | |
84 | ||
85 | # Gets a list of merge requests of a group. | |
86 | # | |
87 | # @example | |
88 | # Gitlab.group_merge_requests(5) | |
89 | # | |
90 | # @param [Integer, String] group_id The ID or name of a group. | |
91 | # @param [Hash] options A customizable set of options. | |
92 | # @return [Array<Gitlab::ObjectifiedHash>] | |
93 | def group_merge_requests(group, options = {}) | |
94 | get("/groups/#{group}/merge_requests", query: options) | |
80 | 95 | end |
81 | 96 | |
82 | 97 | # Adds a user to group. |
190 | 205 | def edit_group(id, options = {}) |
191 | 206 | put("/groups/#{url_encode id}", body: options) |
192 | 207 | end |
208 | ||
209 | # Gets a list of issues of a group. | |
210 | # | |
211 | # @example | |
212 | # Gitlab.group_issues(5) | |
213 | # | |
214 | # @param [Integer, String] group_id The ID or name of a group. | |
215 | # @param [Hash] options A customizable set of options. | |
216 | # @return [Array<Gitlab::ObjectifiedHash>] | |
217 | def group_issues(group, options = {}) | |
218 | get("/groups/#{group}/issues", query: options) | |
219 | end | |
220 | ||
221 | # Sync group with LDAP | |
222 | # | |
223 | # @example | |
224 | # Gitlab.sync_ldap_group(1) | |
225 | # | |
226 | # @param [Integer] id The ID or name of a group. | |
227 | # @return [Array<Gitlab::ObjectifiedHash>] | |
228 | def sync_ldap_group(id) | |
229 | post("/groups/#{url_encode id}/ldap_sync") | |
230 | end | |
231 | ||
232 | # Add LDAP group link | |
233 | # | |
234 | # @example | |
235 | # Gitlab.add_ldap_group_links(1, 'all', 50, 'ldap') | |
236 | # | |
237 | # @param [Integer] id The ID of a group | |
238 | # @param [String] cn The CN of a LDAP group | |
239 | # @param [Integer] group_access Minimum access level for members of the LDAP group. | |
240 | # @param [String] provider LDAP provider for the LDAP group | |
241 | # @return [Gitlab::ObjectifiedHash] Information about added ldap group link | |
242 | def add_ldap_group_links(id, commonname, group_access, provider) | |
243 | post("/groups/#{url_encode id}/ldap_group_links", body: { cn: commonname, group_access: group_access, provider: provider }) | |
244 | end | |
245 | ||
246 | # Delete LDAP group link | |
247 | # | |
248 | # @example | |
249 | # Gitlab.delete_ldap_group_links(1, 'all') | |
250 | # | |
251 | # @param [Integer] id The ID of a group | |
252 | # @param [String] cn The CN of a LDAP group | |
253 | # @return [Gitlab::ObjectifiedHash] Empty hash | |
254 | def delete_ldap_group_links(id, commonname, provider) | |
255 | delete("/groups/#{url_encode id}/ldap_group_links/#{url_encode provider}/#{url_encode commonname}") | |
256 | end | |
193 | 257 | end |
194 | 258 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to issue links. | |
4 | # @see https://docs.gitlab.com/ee/api/issue_links.html | |
5 | module IssueLinks | |
6 | # Gets a list of links for a issue. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.issue_links(5, 10) | |
10 | # | |
11 | # @param [Integer] project The ID of a project. | |
12 | # @param [Integer] issue The ID of an issue. | |
13 | # @option options [Integer] :page The page number. | |
14 | # @option options [Integer] :per_page The number of results per page. | |
15 | # @return [Array<Gitlab::ObjectifiedHash>] | |
16 | def issue_links(project, issue, options = {}) | |
17 | get("/projects/#{url_encode project}/issues/#{issue}/links", query: options) | |
18 | end | |
19 | ||
20 | # Creates a new issue link. | |
21 | # | |
22 | # @example | |
23 | # Gitlab.create_issue_link(6, 1, 6, 2) | |
24 | # | |
25 | # @param [Integer, String] project The ID or name of a project. | |
26 | # @param [Integer] issue The ID of an issue. | |
27 | # @param [Integer] target_project_id Project ID the target issue is located in. | |
28 | # @param [Integer] target_issue_iid The ID of the target issue. | |
29 | # @return [Gitlab::ObjectifiedHash] Information about created link. | |
30 | def create_issue_link(project, issue, target_project_id, target_issue_iid) | |
31 | post("/projects/#{url_encode project}/issues/#{issue}/links", body: { target_project_id: target_project_id, target_issue_iid: target_issue_iid }) | |
32 | end | |
33 | ||
34 | # Deletes an issue link. | |
35 | # | |
36 | # @example | |
37 | # Gitlab.delete_issue_link(5, 10, 123) | |
38 | # | |
39 | # @param [Integer] project The ID of a project. | |
40 | # @param [Integer] issue The ID of an issue. | |
41 | # @param [Integer] id The ID of a link. | |
42 | # @return [Gitlab::ObjectifiedHash] | |
43 | def delete_issue_link(project, issue, id) | |
44 | delete("/projects/#{url_encode project}/issues/#{issue}/links/#{id}") | |
45 | end | |
46 | end | |
47 | end |
180 | 180 | # @param [Integer] id The ID of an issue. |
181 | 181 | # @param [String] duration The time spent in human format. e.g: 3h30m |
182 | 182 | def add_time_spent_on_issue(project, id, duration) |
183 | post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: url_encode(duration) }) | |
183 | post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: duration }) | |
184 | 184 | end |
185 | 185 | |
186 | 186 | # Resets the total spent time for this issue to 0 seconds. |
162 | 162 | def job_artifacts_keep(project_id, job_id) |
163 | 163 | post("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/keep") |
164 | 164 | end |
165 | ||
166 | # Delete Artifacts | |
167 | # Deletes the artifacts associated with a job. | |
168 | # | |
169 | # @example | |
170 | # Gitlab.job_artifacts_delete(1,1) | |
171 | # Gitlab.job_artifacts_delete("project", 1) | |
172 | # | |
173 | # @param [Integer, String] The ID or name of a project. | |
174 | # @param [Integer] the id of the job | |
175 | # @return [Array<Gitlab::ObjectifiedHash>] | |
176 | def job_artifacts_delete(project_id, job_id) | |
177 | delete("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts") | |
178 | end | |
165 | 179 | end |
166 | 180 | end |
0 | 0 | # frozen_string_literal: true |
1 | 1 | |
2 | 2 | class Gitlab::Client |
3 | # Defines methods related to labels. | |
3 | # Defines methods related to project labels. | |
4 | 4 | # @see https://docs.gitlab.com/ce/api/labels.html |
5 | 5 | module Labels |
6 | 6 | # Gets a list of project's labels. |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to lint/validations. | |
4 | # @see https://docs.gitlab.com/ce/api/lint.html | |
5 | module Lint | |
6 | # Checks if your .gitlab-ci.yml file is valid. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.validate_gitlab_ci_yml("{ \"image\": \"ruby:2.6\", \"services\": [\"postgres\"], \"before_script\": [\"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}") | |
10 | # | |
11 | # @param [String] content the .gitlab-ci.yaml content. | |
12 | # @return <Gitlab::ObjectifiedHash> Returns information about validity of the yml. | |
13 | def validate_gitlab_ci_yml(content) | |
14 | body = { content: content } | |
15 | post('/lint', body: body) | |
16 | end | |
17 | end | |
18 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to markdown. | |
4 | # @see https://docs.gitlab.com/ce/api/markdown.html | |
5 | module Markdown | |
6 | # Render an arbitrary Markdown document | |
7 | # | |
8 | # @example | |
9 | # Gitlab.markdown('Hello world! :tada:') | |
10 | # Gitlab.markdown('Hello world! :tada:', gfm: true, project: 'group_example/project_example') | |
11 | # | |
12 | # @param [String] text The markdown text to render. | |
13 | # @param [Hash] options A customizable set of options. | |
14 | # @option options [Boolean] :gfm(optional) Render text using GitLab Flavored Markdown. Default is false. | |
15 | # @option options [String] :project(optional) Use project as a context when creating references using GitLab Flavored Markdown. Authentication is required if a project is not public. | |
16 | # @return <Gitlab::ObjectifiedHash> Returns the rendered markdown as response | |
17 | def markdown(text, options = {}) | |
18 | body = { text: text }.merge(options) | |
19 | post('/markdown', body: body) | |
20 | end | |
21 | end | |
22 | end |
36 | 36 | # Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]}) |
37 | 37 | # |
38 | 38 | # @param [Integer] project(required) The ID of a project. |
39 | # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs | |
40 | # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs | |
39 | # @option options [Array] :approver_ids(required, nil if none) An array of User IDs that can approve MRs | |
40 | # @option options [Array] :approver_group_ids(required, nil if none) An array of Group IDs whose members can approve MRs | |
41 | 41 | # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project |
42 | 42 | def edit_project_approvers(project, options = {}) |
43 | put("/projects/#{url_encode project}/approvals", body: options) | |
43 | put("/projects/#{url_encode project}/approvers", body: options) | |
44 | 44 | end |
45 | 45 | |
46 | 46 | # Get Configuration for approvals on a specific Merge Request. |
75 | 75 | # |
76 | 76 | # @param [Integer] project(required) The ID of a project. |
77 | 77 | # @param [Integer] merge_request(required) The IID of a merge_request. |
78 | # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs | |
79 | # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs | |
78 | # @option options [Array] :approver_ids(required, nil if none) An array of User IDs that can approve MRs | |
79 | # @option options [Array] :approver_group_ids(required, nil if none) An array of Group IDs whose members can approve MRs | |
80 | 80 | # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project |
81 | 81 | def edit_merge_request_approvers(project, merge_request, options = {}) |
82 | put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options) | |
82 | put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvers", body: options) | |
83 | 83 | end |
84 | 84 | |
85 | 85 | # Approve a merge request |
103 | 103 | # |
104 | 104 | # @param [Integer] project(required) The ID of a project. |
105 | 105 | # @param [Integer] merge_request(required) The IID of a merge request. |
106 | # @option options [String] :sudo(optional) The username of the user you want to remove the approval for | |
106 | 107 | # @return [void] This API call returns an empty response body. |
107 | def unapprove_merge_request(project, merge_request) | |
108 | post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove") | |
108 | def unapprove_merge_request(project, merge_request, options = {}) | |
109 | post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove", body: options) | |
109 | 110 | end |
110 | 111 | end |
111 | 112 | end |
52 | 52 | # @return [Array<Gitlab::ObjectifiedHash>] |
53 | 53 | def merge_request_pipelines(project, id) |
54 | 54 | get("/projects/#{url_encode project}/merge_requests/#{id}/pipelines") |
55 | end | |
56 | ||
57 | # Get a list of merge request participants. | |
58 | # | |
59 | # @example | |
60 | # Gitlab.merge_request_participants(5, 36) | |
61 | # | |
62 | # @param [Integer, String] project The ID or name of a project. | |
63 | # @param [Integer] id The ID of a merge request. | |
64 | # @return [Array<Gitlab::ObjectifiedHash>] | |
65 | def merge_request_participants(project, id) | |
66 | get("/projects/#{url_encode project}/merge_requests/#{id}/participants") | |
55 | 67 | end |
56 | 68 | |
57 | 69 | # Creates a merge request. |
275 | 275 | # in the 'else'. |
276 | 276 | def note_content(body) |
277 | 277 | if body.is_a?(Hash) |
278 | STDERR.puts 'Passing the note body as a Hash is deprecated. You should just pass the String.' | |
278 | warn 'Passing the note body as a Hash is deprecated. You should just pass the String.' | |
279 | 279 | body |
280 | 280 | else |
281 | 281 | { body: body } |
76 | 76 | def retry_pipeline(project, id) |
77 | 77 | post("/projects/#{url_encode project}/pipelines/#{id}/retry") |
78 | 78 | end |
79 | ||
80 | # Delete a pipeline | |
81 | # | |
82 | # @example | |
83 | # Gitlab.delete_pipeline(5, 1) | |
84 | # | |
85 | # @param [Integer, String] project The ID or name of a project. | |
86 | # @param [Integer] id The ID of a pipeline. | |
87 | # @return [void] This API call returns an empty response body. | |
88 | def delete_pipeline(project, id) | |
89 | delete("/projects/#{url_encode project}/pipelines/#{id}") | |
90 | end | |
79 | 91 | end |
80 | 92 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to project clusters. | |
4 | # @see https://docs.gitlab.com/ce/api/project_clusters.html | |
5 | module ProjectClusters | |
6 | # Returns a list of project clusters. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.project_clusters(5) | |
10 | # | |
11 | # @param [Integer, String] project The ID or name of a project. | |
12 | # @return [Array<Gitlab::ObjectifiedHash>] List of all clusters of a project | |
13 | def project_clusters(project) | |
14 | get("/projects/#{url_encode project}/clusters") | |
15 | end | |
16 | ||
17 | # Gets a single project cluster. | |
18 | # | |
19 | # @example | |
20 | # Gitlab.project_cluster(5, 42) | |
21 | # | |
22 | # @param [Integer, String] project The ID or name of a project. | |
23 | # @param [Integer] cluster_id The ID of the cluster. | |
24 | # @return [Gitlab::ObjectifiedHash] Information about the requested cluster | |
25 | def project_cluster(project, cluster_id) | |
26 | get("/projects/#{url_encode project}/clusters/#{cluster_id}") | |
27 | end | |
28 | ||
29 | # Adds an existing Kubernetes cluster to the project. | |
30 | # | |
31 | # @example | |
32 | # Gitlab.add_project_cluster(5, 'cluster-5', { enabled: false, platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-5-namespace', authorization_type: 'rbac' } }) | |
33 | # Gitlab.add_project_cluster(5, 'cluster-5', { platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345' } }) | |
34 | # | |
35 | # @param [Integer, String] project The ID or name of a project. | |
36 | # @param [String] name The name of the existing cluster. | |
37 | # @param [Hash] options A customizable set of options. | |
38 | # @option options [Boolean] :enabled(optional) Determines if cluster is active or not, defaults to true | |
39 | # @option options [Hash] :platform_kubernetes_attributes A customizable set of Kubernetes platform attributes | |
40 | # @suboption platform_kubernetes_attributes [String] :api_url(required) The URL to access the Kubernetes API | |
41 | # @suboption platform_kubernetes_attributes [String] :token(required) The token to authenticate against Kubernetes | |
42 | # @suboption platform_kubernetes_attributes [String] :ca_cert(optional) TLS certificate (needed if API is using a self-signed TLS certificate | |
43 | # @suboption platform_kubernetes_attributes [String] :namespace(optional) The unique namespace related to the project | |
44 | # @suboption platform_kubernetes_attributes [String] :authorization_type(optional) The cluster authorization type: rbac, abac or unknown_authorization. Defaults to rbac. | |
45 | # @return [Gitlab::ObjectifiedHash] Information about the added project cluster. | |
46 | def add_project_cluster(project, name, options = {}) | |
47 | body = { name: name }.merge(options) | |
48 | post("/projects/#{url_encode project}/clusters/user", body: body) | |
49 | end | |
50 | ||
51 | # Updates an existing project cluster. | |
52 | # | |
53 | # @example | |
54 | # Gitlab.edit_project_cluster(5, 1, { name: 'cluster-6', platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-6-namespace' } }) | |
55 | # | |
56 | # @param [Integer, String] project The ID or name of a project. | |
57 | # @param [Integer] cluster_id The ID of the cluster. | |
58 | # @param [Hash] options A customizable set of options. | |
59 | # @option options [String] :name(optional) The name of the cluster | |
60 | # @option options [Hash] :platform_kubernetes_attributes A customizable set of Kubernetes platform attributes | |
61 | # @suboption platform_kubernetes_attributes [String] :api_url(required) The URL to access the Kubernetes API | |
62 | # @suboption platform_kubernetes_attributes [String] :token(required) The token to authenticate against Kubernetes | |
63 | # @suboption platform_kubernetes_attributes [String] :ca_cert(optional) TLS certificate (needed if API is using a self-signed TLS certificate | |
64 | # @suboption platform_kubernetes_attributes [String] :namespace(optional) The unique namespace related to the project | |
65 | # @return [Gitlab::ObjectifiedHash] Information about the updated project cluster. | |
66 | def edit_project_cluster(project, cluster_id, options = {}) | |
67 | put("/projects/#{url_encode project}/clusters/#{cluster_id}", body: options) | |
68 | end | |
69 | ||
70 | # Deletes an existing project cluster. | |
71 | # | |
72 | # @example | |
73 | # Gitlab.delete_project_cluster(5, 42) | |
74 | # | |
75 | # @param [Integer, String] project The ID or name of a project. | |
76 | # @param [Integer] cluster_id The ID of the cluster. | |
77 | # @return [nil] This API call returns an empty response body. | |
78 | def delete_project_cluster(project, cluster_id) | |
79 | delete("/projects/#{url_encode project}/clusters/#{cluster_id}") | |
80 | end | |
81 | end | |
82 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to project release links. | |
4 | # @see https://docs.gitlab.com/ce/api/releases/links.html | |
5 | module ProjectReleaseLinks | |
6 | # Get assets as links from a Release. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.project_release_links(5, 'v0.3') | |
10 | # | |
11 | # @param [Integer, String] project The ID or name of a project. | |
12 | # @param [String] tag_name The tag associated with the Release. | |
13 | # @return [Array<Gitlab::ObjectifiedHash>] List of assets as links from a Release. | |
14 | def project_release_links(project, tag_name) | |
15 | get("/projects/#{url_encode project}/releases/#{tag_name}/assets/links") | |
16 | end | |
17 | ||
18 | # Get an asset as link from a Release. | |
19 | # | |
20 | # @example | |
21 | # Gitlab.project_release_link(5, 'v0.3', 1) | |
22 | # | |
23 | # @param [Integer, String] project The ID or name of a project. | |
24 | # @param [String] tag_name The tag associated with the Release. | |
25 | # @param [Integer] link_id The id of the link. | |
26 | # @return [Gitlab::ObjectifiedHash] Information about the release link | |
27 | def project_release_link(project, tag_name, link_id) | |
28 | get("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}") | |
29 | end | |
30 | ||
31 | # Create an asset as a link from a Release. | |
32 | # | |
33 | # @example | |
34 | # Gitlab.create_project_release_link(5, 'v0.1', { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' }) | |
35 | # | |
36 | # @param [Integer, String] project The ID or name of a project. | |
37 | # @param [String] tag_name The tag associated with the Release. | |
38 | # @param [Hash] options A customizable set of options. | |
39 | # @option options [String] :name(required) The name of the link. | |
40 | # @option options [String] :url(required) The URL of the link. | |
41 | # @return [Gitlab::ObjectifiedHash] Information about the created release link. | |
42 | def create_project_release_link(project, tag_name, options = {}) | |
43 | post("/projects/#{url_encode project}/releases/#{tag_name}/assets/links", body: options) | |
44 | end | |
45 | ||
46 | # Update an asset as a link from a Release. You have to specify at least one of name or url | |
47 | # | |
48 | # @example | |
49 | # Gitlab.update_project_release_link(5, 'v0.3', 1, { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' }) | |
50 | # | |
51 | # @param [Integer, String] project The ID or name of a project. | |
52 | # @param [String] tag_name The tag where the release will be created from. | |
53 | # @param [Integer] link_id The id of the link. | |
54 | # @param [Hash] options A customizable set of options. | |
55 | # @option options [String] :name(optional) The name of the link. | |
56 | # @option options [String] :url(optional) The URL of the link. | |
57 | # @return [Gitlab::ObjectifiedHash] Information about the updated release link. | |
58 | def update_project_release_link(project, tag_name, link_id, options = {}) | |
59 | put("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}", body: options) | |
60 | end | |
61 | ||
62 | # Delete an asset as a link from a Release. | |
63 | # | |
64 | # @example | |
65 | # Gitlab.delete_project_release_link(5, 'v0.3', 1) | |
66 | # | |
67 | # @param [Integer, String] project The ID or name of a project. | |
68 | # @param [String] tag_name The tag where the release will be created from. | |
69 | # @param [Integer] link_id The id of the link. | |
70 | # @return [Gitlab::ObjectifiedHash] Information about the deleted release link. | |
71 | def delete_project_release_link(project, tag_name, link_id) | |
72 | delete("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}") | |
73 | end | |
74 | end | |
75 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to project releases. | |
4 | # @see https://docs.gitlab.com/ce/api/releases/ | |
5 | module ProjectReleases | |
6 | # Returns Paginated list of a project's releases, sorted by created_at. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.project_releases(5) | |
10 | # | |
11 | # @param [Integer, String] project The ID or name of a project. | |
12 | # @return [Array<Gitlab::ObjectifiedHash>] Paginated list of Releases, sorted by created_at. | |
13 | def project_releases(project) | |
14 | get("/projects/#{url_encode project}/releases") | |
15 | end | |
16 | ||
17 | # Gets a Release by a tag name | |
18 | # | |
19 | # @example | |
20 | # Gitlab.project_release(5, 'v0.1') | |
21 | # | |
22 | # @param [Integer, String] project The ID or name of a project. | |
23 | # @param [String] tag_name The tag where the release will be created from.. | |
24 | # @return [Gitlab::ObjectifiedHash] Information about the release | |
25 | def project_release(project, tag_name) | |
26 | get("/projects/#{url_encode project}/releases/#{tag_name}") | |
27 | end | |
28 | ||
29 | # Creates a Release. You need push access to the repository to create a Release. | |
30 | # | |
31 | # @example | |
32 | # Gitlab.create_project_release(5, { name: 'New Release', tag_name: 'v0.3', description: 'Super nice release' }) | |
33 | # Gitlab.create_project_release(5, { name: 'New Release', tag_name: 'v0.3', description: 'Super nice release', assets: { links: [{ name: 'hoge', url: 'https://google.com' }] } }) | |
34 | # | |
35 | # @param [Integer, String] project The ID or name of a project. | |
36 | # @param [Hash] options A customizable set of options. | |
37 | # @option options [String] :name(required) The release name. | |
38 | # @option options [String] :tag_name(required) The tag where the release will be created from. | |
39 | # @option options [String] :description(required) The description of the release. You can use markdown. | |
40 | # @option options [String] :ref(optional) If tag_name does not exist, the release will be created from ref. It can be a commit SHA, another tag name, or a branch name. | |
41 | # @option options [Hash] :assets(optional) A customizable set of options for release assets | |
42 | # @asset assets [Array<link>] :links(optional) An array of assets links as hashes. | |
43 | # @link links [Hash] link_elements A combination of a link name and a link url | |
44 | # @link_element [String] :name The name of the link. | |
45 | # @link_element [String] :url The url of the link. | |
46 | # @return [Gitlab::ObjectifiedHash] Information about the created release. | |
47 | def create_project_release(project, options = {}) | |
48 | post("/projects/#{url_encode project}/releases", body: options) | |
49 | end | |
50 | ||
51 | # Updates a release. | |
52 | # | |
53 | # @example | |
54 | # Gitlab.update_project_release(5, 'v0.3', { name: 'New Release', description: 'Super nice release' }) | |
55 | # | |
56 | # @param [Integer, String] project The ID or name of a project. | |
57 | # @param [String] tag_name The tag where the release will be created from. | |
58 | # @param [Hash] options A customizable set of options. | |
59 | # @option options [String] :name(optional) The release name. | |
60 | # @option options [String] :description(optional) The description of the release. You can use markdown. | |
61 | # @return [Gitlab::ObjectifiedHash] Information about the updated release. | |
62 | def update_project_release(project, tag_name, options = {}) | |
63 | put("/projects/#{url_encode project}/releases/#{tag_name}", body: options) | |
64 | end | |
65 | ||
66 | # Delete a Release. Deleting a Release will not delete the associated tag. | |
67 | # | |
68 | # @example | |
69 | # Gitlab.delete_project_release(5, 'v0.3') | |
70 | # | |
71 | # @param [Integer, String] project The ID or name of a project. | |
72 | # @param [String] tag_name The tag where the release will be created from. | |
73 | # @return [Gitlab::ObjectifiedHash] Information about the deleted release. | |
74 | def delete_project_release(project, tag_name) | |
75 | delete("/projects/#{url_encode project}/releases/#{tag_name}") | |
76 | end | |
77 | end | |
78 | end |
66 | 66 | # @option options [Boolean] :issues_enabled The issues integration for a project (0 = false, 1 = true). |
67 | 67 | # @option options [Boolean] :snippets_enabled The snippets integration for a project (0 = false, 1 = true). |
68 | 68 | # @option options [Boolean] :merge_requests_enabled The merge requests functionality for a project (0 = false, 1 = true). |
69 | # @option options [Boolean] :public The setting for making a project public (0 = false, 1 = true). | |
69 | # @option options [String] :visibility The setting for making a project public ('private', 'internal', 'public'). | |
70 | 70 | # @option options [Integer] :user_id The user/owner id of a project. |
71 | 71 | # @return [Gitlab::ObjectifiedHash] Information about created project. |
72 | 72 | def create_project(name, options = {}) |
379 | 379 | post("/projects/#{url_encode project}/deploy_keys/#{key}/disable", body: { id: project, key_id: key }) |
380 | 380 | end |
381 | 381 | |
382 | # Updates an existing deploy key. | |
383 | # | |
384 | # @example | |
385 | # Gitlab.edit_deploy_key(42, 66, 'New key name', can_push: false) | |
386 | # | |
387 | # @param [Integer, String] project The ID or path of a project. | |
388 | # @param [Integer] id The ID of a deploy key. | |
389 | # @param [String] title The title of a deploy key. | |
390 | # @param [Hash] options A customizable set of options. | |
391 | # @return [Gitlab::ObjectifiedHash] Information about created deploy key. | |
392 | def edit_deploy_key(project, id, title, options = {}) | |
393 | put("/projects/#{url_encode project}/deploy_keys/#{id}", body: { title: title }.merge(options)) | |
394 | end | |
395 | ||
382 | 396 | # Deletes a deploy key from project. |
383 | 397 | # |
384 | 398 | # @example |
528 | 542 | # @see https://docs.gitlab.com/ee/api/projects.html#upload-a-file |
529 | 543 | # |
530 | 544 | # @example |
531 | # Gitlab.upload_file(1, File.open(File::NULL, 'r')) | |
532 | # File.open('myfile') { |file| Gitlab.upload_file(1, file) } | |
545 | # Gitlab.upload_file(1, '/full/path/to/avatar.jpg') | |
533 | 546 | # |
534 | 547 | # @param [Integer, String] id The ID or path of a project. |
535 | # @param [File] The file you are interested to upload. | |
548 | # @param [String] file_fullpath The fullpath of the file you are interested to upload. | |
536 | 549 | # @return [Gitlab::ObjectifiedHash] |
537 | def upload_file(id, file) | |
538 | post("/projects/#{url_encode id}/uploads", body: { file: file }) | |
550 | def upload_file(id, file_fullpath) | |
551 | post("/projects/#{url_encode id}/uploads", body: { file: File.open(file_fullpath, 'r') }) | |
539 | 552 | end |
540 | 553 | |
541 | 554 | # Get all project templates of a particular type |
569 | 582 | def project_template(project, type, key, options = {}) |
570 | 583 | get("/projects/#{url_encode project}/templates/#{type}/#{key}", query: options) |
571 | 584 | end |
585 | ||
586 | # Archives a project. | |
587 | # | |
588 | # @example | |
589 | # Gitlab.archive_project(4) | |
590 | # | |
591 | # @param [Integer, String] id The ID or path of a project. | |
592 | # @return [Gitlab::ObjectifiedHash] Information about archived project. | |
593 | def archive_project(id) | |
594 | post("/projects/#{url_encode id}/archive") | |
595 | end | |
596 | ||
597 | # Unarchives a project. | |
598 | # | |
599 | # @example | |
600 | # Gitlab.unarchive_project(4) | |
601 | # | |
602 | # @param [Integer, String] id The ID or path of a project. | |
603 | # @return [Gitlab::ObjectifiedHash] Information about unarchived project. | |
604 | def unarchive_project(id) | |
605 | post("/projects/#{url_encode id}/unarchive") | |
606 | end | |
572 | 607 | end |
573 | 608 | end |
12 | 12 | # @param [Integer, String] project The ID or name of a project. |
13 | 13 | # @param [Hash] options A customizable set of options. |
14 | 14 | # @option options [String] :path The path inside repository. |
15 | # @option options [String] :ref_name The name of a repository branch or tag. | |
15 | # @option options [String] :ref The name of a repository branch or tag. | |
16 | # @option options [Integer] :per_page Number of results to show per page (default = 20) | |
16 | 17 | # @return [Gitlab::ObjectifiedHash] |
17 | 18 | def tree(project, options = {}) |
18 | 19 | get("/projects/#{url_encode project}/repository/tree", query: options) |
27 | 28 | # |
28 | 29 | # @param [Integer, String] project The ID or name of a project. |
29 | 30 | # @param [String] ref The commit sha, branch, or tag to download. |
31 | # @param [String] format The archive format. Options are: tar.gz (default), tar.bz2, tbz, tbz2, tb2, bz2, tar, and zip | |
30 | 32 | # @return [Gitlab::FileResponse] |
31 | def repo_archive(project, ref = 'master') | |
32 | get("/projects/#{url_encode project}/repository/archive", | |
33 | def repo_archive(project, ref = 'master', format = 'tar.gz') | |
34 | get("/projects/#{url_encode project}/repository/archive.#{format}", | |
33 | 35 | format: nil, |
34 | 36 | headers: { Accept: 'application/octet-stream' }, |
35 | 37 | query: { sha: ref }, |
69 | 71 | def merge_base(project, refs) |
70 | 72 | get("/projects/#{url_encode project}/repository/merge_base", query: { refs: refs }) |
71 | 73 | end |
74 | ||
75 | # Get project repository contributors. | |
76 | # | |
77 | # @example | |
78 | # Gitlab.contributors(42) | |
79 | # Gitlab.contributors(42, { order: 'name' }) | |
80 | # | |
81 | # @param [Integer, String] project The ID or name of a project. | |
82 | # @param [Hash] options A customizable set of options. | |
83 | # @option options [String] :order_by Order by name, email or commits (default = commits). | |
84 | # @option options [String] :sort Sort order asc or desc (default = asc). | |
85 | # @return [Array<Gitlab::ObjectifiedHash>] | |
86 | def contributors(project, options = {}) | |
87 | get("/projects/#{url_encode project}/repository/contributors", query: options) | |
88 | end | |
89 | alias repo_contributors contributors | |
72 | 90 | end |
73 | 91 | end |
23 | 23 | parser: ::Gitlab::Request::Parser |
24 | 24 | end |
25 | 25 | alias repo_file_contents file_contents |
26 | ||
27 | # Get file blame from repository | |
28 | # | |
29 | # @example | |
30 | # Gitlab.get_file_blame(42, "README.md", "master") | |
31 | # | |
32 | # @param [Integer, String] project The ID or name of a project. | |
33 | # @param [String] file_path The full path of the file. | |
34 | # @param [String] ref The name of branch, tag or commit. | |
35 | # @return [Gitlab::ObjectifiedHash] | |
36 | # | |
37 | def get_file_blame(project, file_path, ref) | |
38 | get("/projects/#{url_encode project}/repository/files/#{url_encode file_path}/blame", query: { | |
39 | ref: ref | |
40 | }) | |
41 | end | |
26 | 42 | |
27 | 43 | # Gets a repository file. |
28 | 44 | # |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to resource label events. | |
4 | # @see https://docs.gitlab.com/ee/api/resource_label_events.html | |
5 | module ResourceLabelEvents | |
6 | # Gets a list of all label events for a single issue. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.issue_label_events(5, 42) | |
10 | # | |
11 | # @param [Integer, String] project The ID or name of a project. | |
12 | # @param [Integer] issue_iid The IID of an issue. | |
13 | # @return [Array<Gitlab::ObjectifiedHash>] | |
14 | def issue_label_events(project, issue_iid) | |
15 | get("/projects/#{url_encode project}/issues/#{issue_iid}/resource_label_events") | |
16 | end | |
17 | ||
18 | # Returns a single label event for a specific project issue | |
19 | # | |
20 | # @example | |
21 | # Gitlab.issue_label_event(5, 42, 1) | |
22 | # | |
23 | # @param [Integer, String] project The ID or name of a project. | |
24 | # @param [Integer] issue_iid The IID of an issue. | |
25 | # @param [Integer] id The ID of a label event. | |
26 | # @return Gitlab::ObjectifiedHash | |
27 | def issue_label_event(project, issue_iid, id) | |
28 | get("/projects/#{url_encode project}/issues/#{issue_iid}/resource_label_events/#{id}") | |
29 | end | |
30 | ||
31 | # Gets a list of all label events for a single epic. | |
32 | # | |
33 | # @example | |
34 | # Gitlab.epic_label_events(5, 42) | |
35 | # | |
36 | # @param [Integer, String] group The ID or name of a group. | |
37 | # @param [Integer] epic_id The ID of an epic. | |
38 | # @return [Array<Gitlab::ObjectifiedHash>] | |
39 | def epic_label_events(group, epic_id) | |
40 | get("/groups/#{url_encode group}/epics/#{epic_id}/resource_label_events") | |
41 | end | |
42 | ||
43 | # Returns a single label event for a specific group epic | |
44 | # | |
45 | # @example | |
46 | # Gitlab.epic_label_event(5, 42, 1) | |
47 | # | |
48 | # @param [Integer, String] group The ID or name of a group. | |
49 | # @param [Integer] epic_id The ID of an epic. | |
50 | # @param [Integer] id The ID of a label event. | |
51 | # @return Gitlab::ObjectifiedHash | |
52 | def epic_label_event(group, epic_id, id) | |
53 | get("/groups/#{url_encode group}/epics/#{epic_id}/resource_label_events/#{id}") | |
54 | end | |
55 | ||
56 | # Gets a list of all label events for a single merge request. | |
57 | # | |
58 | # @example | |
59 | # Gitlab.merge_request_label_events(5, 42) | |
60 | # | |
61 | # @param [Integer, String] project The ID or name of a project. | |
62 | # @param [Integer] merge_request_iid The IID of a merge request. | |
63 | # @return [Array<Gitlab::ObjectifiedHash>] | |
64 | def merge_request_label_events(project, merge_request_iid) | |
65 | get("/projects/#{url_encode project}/merge_requests/#{merge_request_iid}/resource_label_events") | |
66 | end | |
67 | ||
68 | # Returns a single label event for a specific project merge request | |
69 | # | |
70 | # @example | |
71 | # Gitlab.merge_request_label_event(5, 42, 1) | |
72 | # | |
73 | # @param [Integer, String] project The ID or name of a project. | |
74 | # @param [Integer] merge_request_iid The IID of an merge request. | |
75 | # @param [Integer] id The ID of a label event. | |
76 | # @return Gitlab::ObjectifiedHash | |
77 | def merge_request_label_event(project, merge_request_iid, id) | |
78 | get("/projects/#{url_encode project}/merge_requests/#{merge_request_iid}/resource_label_events/#{id}") | |
79 | end | |
80 | end | |
81 | end |
78 | 78 | # Gitlab.runner_jobs(1) |
79 | 79 | # |
80 | 80 | # @param [Integer] id The ID of a runner. |
81 | # @param [Hash] options A customizable set of options. | |
82 | # @option options [String] :status Status of the job; one of: running, success, failed, canceled | |
81 | 83 | # @return [Array<Gitlab::ObjectifiedHash>] |
82 | def runner_jobs(runner_id) | |
83 | get("/runners/#{url_encode runner_id}/jobs") | |
84 | def runner_jobs(runner_id, options = {}) | |
85 | get("/runners/#{url_encode runner_id}/jobs", query: options) | |
84 | 86 | end |
85 | 87 | |
86 | 88 | # List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings. |
121 | 123 | def project_disable_runner(id, runner_id) |
122 | 124 | delete("/projects/#{url_encode id}/runners/#{runner_id}") |
123 | 125 | end |
126 | ||
127 | # Register a new Runner for the instance. | |
128 | # | |
129 | # @example | |
130 | # Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e') | |
131 | # Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e', description: 'Some Description', active: true, locked: false) | |
132 | # | |
133 | # @param [String] token Registration token. | |
134 | # @param [Hash] options A customizable set of options. | |
135 | # @option options [String] :description Runner description. | |
136 | # @option options [Hash] :info Runner metadata. | |
137 | # @option options [Boolean] :active Whether the Runner is active. | |
138 | # @option options [Boolean] :locked Whether the Runner should be locked for current project. | |
139 | # @option options [Boolean] :run_untagged Whether the Runner should handle untagged jobs. | |
140 | # @option options [Array<String>] :tag_list List of Runner tags. | |
141 | # @option options [Integer] :maximum_timeout Maximum timeout set when this Runner will handle the job. | |
142 | # @return <Gitlab::ObjectifiedHash> Response against runner registration | |
143 | def register_runner(token, options = {}) | |
144 | body = { token: token }.merge(options) | |
145 | post('/runners', body: body) | |
146 | end | |
147 | ||
148 | # Deletes a registed Runner. | |
149 | # | |
150 | # @example | |
151 | # Gitlab.delete_registered_runner('9142c16ea169eaaea3d752313a434a6e') | |
152 | # | |
153 | # @param [String] token Runner authentication token. | |
154 | # @return [nil] This API call returns an empty response body. | |
155 | def delete_registered_runner(token) | |
156 | body = { token: token } | |
157 | delete('/runners', body: body) | |
158 | end | |
159 | ||
160 | # Validates authentication credentials for a registered Runner. | |
161 | # | |
162 | # @example | |
163 | # Gitlab.verify_auth_registered_runner('9142c16ea169eaaea3d752313a434a6e') | |
164 | # | |
165 | # @param [String] token Runner authentication token. | |
166 | # @return [nil] This API call returns an empty response body. | |
167 | def verify_auth_registered_runner(token) | |
168 | body = { token: token } | |
169 | post('/runners/verify', body: body) | |
170 | end | |
124 | 171 | end |
125 | 172 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | class Gitlab::Client | |
3 | # Defines methods related to global searches, searching in projects and searching in groups. | |
4 | # @see https://docs.gitlab.com/ce/api/search.html | |
5 | module Search | |
6 | # Search globally across the GitLab instance. | |
7 | # | |
8 | # @example | |
9 | # Gitlab.search_globally('projects', 'gitlab') | |
10 | # Gitlab.search_globally('issues', 'gitlab') | |
11 | # Gitlab.search_globally('merge_requests', 'gitlab') | |
12 | # Gitlab.search_globally('milestones', 'gitlab') | |
13 | # Gitlab.search_globally('snippet_titles', 'gitlab') | |
14 | # Gitlab.search_globally('snippet_blobs', 'gitlab') | |
15 | # | |
16 | # @param [String] scope The scope to search in. Currently these scopes are supported: projects, issues, merge_requests, milestones, snippet_titles, snippet_blobs. | |
17 | # @param [String] search The search query. | |
18 | # @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope. | |
19 | def search_globally(scope, search) | |
20 | options = { scope: scope, search: search } | |
21 | get('/search', query: options) | |
22 | end | |
23 | ||
24 | # Search within the specified group. | |
25 | # | |
26 | # @example | |
27 | # Gitlab.search_in_group(1, 'projects', 'gitlab') | |
28 | # Gitlab.search_in_group(1, 'issues', 'gitlab') | |
29 | # Gitlab.search_in_group(1, 'merge_requests', 'gitlab') | |
30 | # Gitlab.search_in_group(1, 'milestones', 'gitlab') | |
31 | # | |
32 | # @param [Integer, String] group The ID or name of a group. | |
33 | # @param [String] scope The scope to search in. Currently these scopes are supported: projects, issues, merge_requests, milestones. | |
34 | # @param [String] search The search query. | |
35 | # @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope. | |
36 | def search_in_group(group, scope, search) | |
37 | options = { scope: scope, search: search } | |
38 | get("/groups/#{url_encode group}/search", query: options) | |
39 | end | |
40 | ||
41 | # Search within the specified project. | |
42 | # | |
43 | # @example | |
44 | # Gitlab.search_in_project(1, 'issues', 'gitlab') | |
45 | # Gitlab.search_in_project(1, 'merge_requests', 'gitlab') | |
46 | # Gitlab.search_in_project(1, 'milestones', 'gitlab') | |
47 | # Gitlab.search_in_project(1, 'notes', 'gitlab') | |
48 | # Gitlab.search_in_project(1, 'wiki_blobs', 'gitlab') | |
49 | # Gitlab.search_in_project(1, 'commits', 'gitlab') | |
50 | # Gitlab.search_in_project(1, 'blobs', 'gitlab') | |
51 | # | |
52 | # @param [Integer, String] project The ID or name of a project. | |
53 | # @param [String] scope The scope to search in. Currently these scopes are supported: issues, merge_requests, milestones, notes, wiki_blobs, commits, blobs. | |
54 | # @param [String] search The search query. | |
55 | # @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope. | |
56 | def search_in_project(project, scope, search, ref = nil) | |
57 | options = { scope: scope, search: search } | |
58 | ||
59 | # Add ref filter if provided - backward compatible with main project | |
60 | options[:ref] = ref unless ref.nil? | |
61 | ||
62 | get("/projects/#{url_encode project}/search", query: options) | |
63 | end | |
64 | end | |
65 | end |
36 | 36 | # @example |
37 | 37 | # Gitlab.create_user('joe@foo.org', 'secret', 'joe', { name: 'Joe Smith' }) |
38 | 38 | # or |
39 | # Gitlab.create_user('joe@foo.org', 'secret') | |
40 | # | |
41 | # @param [String] email The email of a user. | |
42 | # @param [String] password The password of a user. | |
43 | # @param [String] username The username of a user. | |
39 | # Gitlab.create_user('joe@foo.org', 'secret', 'joe') | |
40 | # | |
41 | # @param [String] email(required) The email of a user. | |
42 | # @param [String] password(required) The password of a user. | |
43 | # @param [String] username(required) The username of a user. | |
44 | 44 | # @param [Hash] options A customizable set of options. |
45 | 45 | # @option options [String] :name The name of a user. Defaults to email. |
46 | 46 | # @option options [String] :skype The skype of a user. |
50 | 50 | # @return [Gitlab::ObjectifiedHash] Information about created user. |
51 | 51 | def create_user(*args) |
52 | 52 | options = args.last.is_a?(Hash) ? args.pop : {} |
53 | body = if args[2] | |
54 | { email: args[0], password: args[1], username: args[2] } | |
55 | else | |
56 | { email: args[0], password: args[1], name: args[0] } | |
57 | end | |
53 | raise ArgumentError, 'Missing required parameters' unless args[2] | |
54 | ||
55 | body = { email: args[0], password: args[1], username: args[2], name: args[0] } | |
58 | 56 | body.merge!(options) |
59 | 57 | post('/users', body: body) |
60 | 58 | end |
6 | 6 | |
7 | 7 | # Please keep in alphabetical order |
8 | 8 | include AccessRequests |
9 | include ApplicationSettings | |
10 | include Avatar | |
9 | 11 | include AwardEmojis |
10 | 12 | include Boards |
11 | 13 | include Branches |
13 | 15 | include BuildVariables |
14 | 16 | include Builds |
15 | 17 | include Commits |
18 | include ContainerRegistry | |
16 | 19 | include Deployments |
17 | 20 | include Environments |
21 | include Epics | |
18 | 22 | include Events |
23 | include Features | |
24 | include GroupBoards | |
25 | include GroupLabels | |
19 | 26 | include GroupMilestones |
20 | 27 | include Groups |
28 | include IssueLinks | |
21 | 29 | include Issues |
22 | 30 | include Jobs |
23 | 31 | include Keys |
24 | 32 | include Labels |
33 | include Lint | |
34 | include Markdown | |
25 | 35 | include MergeRequestApprovals |
26 | 36 | include MergeRequests |
27 | 37 | include Milestones |
31 | 41 | include PipelineTriggers |
32 | 42 | include Pipelines |
33 | 43 | include ProjectBadges |
44 | include ProjectClusters | |
45 | include ProjectReleaseLinks | |
46 | include ProjectReleases | |
34 | 47 | include Projects |
35 | 48 | include ProtectedTags |
36 | 49 | include Repositories |
37 | 50 | include RepositoryFiles |
38 | 51 | include RepositorySubmodules |
52 | include ResourceLabelEvents | |
39 | 53 | include Runners |
54 | include Search | |
40 | 55 | include Services |
41 | 56 | include Sidekiq |
42 | 57 | include Snippets |
57 | 72 | inspected |
58 | 73 | end |
59 | 74 | |
75 | # Utility method for URL encoding of a string. | |
76 | # Copied from https://ruby-doc.org/stdlib-2.7.0/libdoc/erb/rdoc/ERB/Util.html | |
77 | # | |
78 | # @return [String] | |
60 | 79 | def url_encode(url) |
61 | URI.encode(url.to_s, /\W/) | |
80 | url.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| sprintf('%%%02X', m.unpack1('C')) } # rubocop:disable Style/FormatString, Style/FormatStringToken | |
62 | 81 | end |
63 | 82 | |
64 | 83 | private |
34 | 34 | |
35 | 35 | # Resets all configuration options to the defaults. |
36 | 36 | def reset |
37 | self.endpoint = ENV['GITLAB_API_ENDPOINT'] | |
37 | self.endpoint = ENV['GITLAB_API_ENDPOINT'] || ENV['CI_API_V4_URL'] | |
38 | 38 | self.private_token = ENV['GITLAB_API_PRIVATE_TOKEN'] || ENV['GITLAB_API_AUTH_TOKEN'] |
39 | 39 | self.httparty = get_httparty_config(ENV['GITLAB_API_HTTPARTY_OPTIONS']) |
40 | 40 | self.sudo = nil |
39 | 39 | # |
40 | 40 | # @return [String] |
41 | 41 | def build_error_message |
42 | parsed_response = @response.parsed_response | |
42 | parsed_response = classified_response | |
43 | 43 | message = check_error_keys(parsed_response) |
44 | 44 | "Server responded with code #{@response.code}, message: " \ |
45 | 45 | "#{handle_message(message)}. " \ |
51 | 51 | def check_error_keys(resp) |
52 | 52 | key = POSSIBLE_MESSAGE_KEYS.find { |k| resp.respond_to?(k) } |
53 | 53 | key ? resp.send(key) : resp |
54 | end | |
55 | ||
56 | # Parse the body based on the classification of the body content type | |
57 | # | |
58 | # @return parsed response | |
59 | def classified_response | |
60 | if @response.respond_to?('headers') | |
61 | @response.headers['content-type'] == 'text/plain' ? { message: @response.to_s } : @response.parsed_response | |
62 | else | |
63 | @response.parsed_response | |
64 | end | |
54 | 65 | end |
55 | 66 | |
56 | 67 | # Handle error response message in case of nested hashes |
83 | 94 | # Raised when API endpoint returns the HTTP status code 405. |
84 | 95 | class MethodNotAllowed < ResponseError; end |
85 | 96 | |
97 | # Raised when API endpoint returns the HTTP status code 406. | |
98 | class NotAcceptable < ResponseError; end | |
99 | ||
86 | 100 | # Raised when API endpoint returns the HTTP status code 409. |
87 | 101 | class Conflict < ResponseError; end |
88 | 102 | |
89 | 103 | # Raised when API endpoint returns the HTTP status code 422. |
90 | 104 | class Unprocessable < ResponseError; end |
105 | ||
106 | # Raised when API endpoint returns the HTTP status code 429. | |
107 | class TooManyRequests < ResponseError; end | |
91 | 108 | |
92 | 109 | # Raised when API endpoint returns the HTTP status code 500. |
93 | 110 | class InternalServerError < ResponseError; end |
97 | 114 | |
98 | 115 | # Raised when API endpoint returns the HTTP status code 503. |
99 | 116 | class ServiceUnavailable < ResponseError; end |
117 | ||
118 | # HTTP status codes mapped to error classes. | |
119 | STATUS_MAPPINGS = { | |
120 | 400 => BadRequest, | |
121 | 401 => Unauthorized, | |
122 | 403 => Forbidden, | |
123 | 404 => NotFound, | |
124 | 405 => MethodNotAllowed, | |
125 | 406 => NotAcceptable, | |
126 | 409 => Conflict, | |
127 | 422 => Unprocessable, | |
128 | 429 => TooManyRequests, | |
129 | 500 => InternalServerError, | |
130 | 502 => BadGateway, | |
131 | 503 => ServiceUnavailable | |
132 | }.freeze | |
100 | 133 | end |
101 | 134 | end |
79 | 79 | |
80 | 80 | # Massage output from 'ri'. |
81 | 81 | def change_help_output!(cmd, output_str) |
82 | output_str = +output_str | |
82 | 83 | output_str.gsub!(/#{cmd}\((.*?)\)/m, cmd + ' \1') |
83 | 84 | output_str.gsub!(/\,[\s]*/, ' ') |
84 | 85 |
55 | 55 | response |
56 | 56 | end |
57 | 57 | |
58 | def paginate_with_limit(limit) | |
59 | response = block_given? ? nil : [] | |
60 | count = 0 | |
61 | each_page do |page| | |
62 | if block_given? | |
63 | page.each do |item| | |
64 | yield item | |
65 | count += 1 | |
66 | break if count >= limit | |
67 | end | |
68 | else | |
69 | response += page[0, limit - count] | |
70 | count = response.length | |
71 | end | |
72 | break if count >= limit | |
73 | end | |
74 | response | |
75 | end | |
76 | ||
58 | 77 | def last_page? |
59 | 78 | !(@links.nil? || @links.last.nil?) |
60 | 79 | end |
40 | 40 | |
41 | 41 | %w[get post put delete].each do |method| |
42 | 42 | define_method method do |path, options = {}| |
43 | httparty_config(options) | |
44 | authorization_header(options) | |
45 | validate self.class.send(method, @endpoint + path, options) | |
43 | params = options.dup | |
44 | ||
45 | httparty_config(params) | |
46 | ||
47 | unless params[:unauthenticated] | |
48 | params[:headers] ||= {} | |
49 | params[:headers].merge!(authorization_header) | |
50 | end | |
51 | ||
52 | validate self.class.send(method, @endpoint + path, params) | |
46 | 53 | end |
47 | 54 | end |
48 | 55 | |
49 | 56 | # Checks the response code for common errors. |
50 | 57 | # Returns parsed response for successful requests. |
51 | 58 | def validate(response) |
52 | error_klass = case response.code | |
53 | when 400 then Error::BadRequest | |
54 | when 401 then Error::Unauthorized | |
55 | when 403 then Error::Forbidden | |
56 | when 404 then Error::NotFound | |
57 | when 405 then Error::MethodNotAllowed | |
58 | when 409 then Error::Conflict | |
59 | when 422 then Error::Unprocessable | |
60 | when 500 then Error::InternalServerError | |
61 | when 502 then Error::BadGateway | |
62 | when 503 then Error::ServiceUnavailable | |
63 | end | |
64 | ||
59 | error_klass = Error::STATUS_MAPPINGS[response.code] | |
65 | 60 | raise error_klass, response if error_klass |
66 | 61 | |
67 | 62 | parsed = response.parsed_response |
73 | 68 | # Sets a base_uri and default_params for requests. |
74 | 69 | # @raise [Error::MissingCredentials] if endpoint not set. |
75 | 70 | def request_defaults(sudo = nil) |
76 | self.class.default_params sudo: sudo | |
77 | 71 | raise Error::MissingCredentials, 'Please set an endpoint to API' unless @endpoint |
78 | 72 | |
73 | self.class.default_params sudo: sudo | |
79 | 74 | self.class.default_params.delete(:sudo) if sudo.nil? |
80 | 75 | end |
81 | 76 | |
82 | 77 | private |
83 | 78 | |
84 | # Sets a PRIVATE-TOKEN or Authorization header for requests. | |
79 | # Returns an Authorization header hash | |
85 | 80 | # |
86 | # @param [Hash] options A customizable set of options. | |
87 | # @option options [Boolean] :unauthenticated true if the API call does not require user authentication. | |
88 | 81 | # @raise [Error::MissingCredentials] if private_token and auth_token are not set. |
89 | def authorization_header(options) | |
90 | return if options[:unauthenticated] | |
82 | def authorization_header | |
91 | 83 | raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless @private_token |
92 | 84 | |
93 | options[:headers] = if @private_token.size < 21 | |
94 | { 'PRIVATE-TOKEN' => @private_token } | |
95 | else | |
96 | { 'Authorization' => "Bearer #{@private_token}" } | |
97 | end | |
85 | if @private_token.size < 21 | |
86 | { 'PRIVATE-TOKEN' => @private_token } | |
87 | else | |
88 | { 'Authorization' => "Bearer #{@private_token}" } | |
89 | end | |
98 | 90 | end |
99 | 91 | |
100 | 92 | # Set HTTParty configuration |
29 | 29 | private |
30 | 30 | |
31 | 31 | def history_file |
32 | if defined?(@history_file) | |
33 | @history_file | |
34 | else | |
35 | @history_file = File.open(history_file_path, 'w', 0o600).tap do |file| | |
36 | file.sync = true | |
37 | end | |
32 | @history_file ||= File.open(history_file_path, 'w', 0o600).tap do |file| | |
33 | file.sync = true | |
38 | 34 | end |
39 | 35 | rescue Errno::EACCES |
40 | 36 | warn 'History not saved; unable to open your history file for writing.' |
49 | 45 | path = history_file_path |
50 | 46 | |
51 | 47 | File.foreach(path) { |line| yield(line) } if File.exist?(path) |
52 | rescue StandardError => error | |
53 | warn "History file not loaded: #{error.message}" | |
48 | rescue StandardError => e | |
49 | warn "History file not loaded: #{e.message}" | |
54 | 50 | end |
55 | 51 | |
56 | 52 | def max_lines |
0 | 0 | # frozen_string_literal: true |
1 | 1 | |
2 | 2 | module Gitlab |
3 | VERSION = '4.8.0' | |
3 | VERSION = '4.14.1' | |
4 | 4 | end |
0 | { | |
1 | "default_projects_limit": 100000, | |
2 | "signup_enabled": true, | |
3 | "id": 1, | |
4 | "default_branch_protection": 2, | |
5 | "restricted_visibility_levels": [], | |
6 | "password_authentication_enabled_for_web": true, | |
7 | "after_sign_out_path": null, | |
8 | "max_attachment_size": 10, | |
9 | "user_oauth_applications": true, | |
10 | "updated_at": "2016-01-04T15:44:55.176Z", | |
11 | "session_expire_delay": 10080, | |
12 | "home_page_url": null, | |
13 | "default_snippet_visibility": "private", | |
14 | "domain_whitelist": [], | |
15 | "domain_blacklist_enabled": false, | |
16 | "domain_blacklist": [], | |
17 | "created_at": "2016-01-04T15:44:55.176Z", | |
18 | "default_project_visibility": "private", | |
19 | "default_group_visibility": "private", | |
20 | "gravatar_enabled": true, | |
21 | "sign_in_text": null, | |
22 | "container_registry_token_expire_delay": 5, | |
23 | "repository_storages": [ | |
24 | "default" | |
25 | ], | |
26 | "plantuml_enabled": false, | |
27 | "plantuml_url": null, | |
28 | "terminal_max_session_time": 0, | |
29 | "polling_interval_multiplier": 1, | |
30 | "rsa_key_restriction": 0, | |
31 | "dsa_key_restriction": 0, | |
32 | "ecdsa_key_restriction": 0, | |
33 | "ed25519_key_restriction": 0, | |
34 | "first_day_of_week": 0, | |
35 | "enforce_terms": true, | |
36 | "terms": "Hello world!", | |
37 | "performance_bar_allowed_group_id": 42, | |
38 | "instance_statistics_visibility_private": false, | |
39 | "user_show_add_ssh_key_message": true, | |
40 | "file_template_project_id": 1, | |
41 | "local_markdown_version": 0, | |
42 | "geo_node_allowed_ips": "0.0.0.0/0, ::/0" | |
43 | } |
0 | { | |
1 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=64&d=identicon" | |
2 | } |
0 | { | |
1 | "id": 1, | |
2 | "name": "project issue board", | |
3 | "project": { | |
4 | "id": 5, | |
5 | "name": "Diaspora Project Site", | |
6 | "name_with_namespace": "Diaspora / Diaspora Project Site", | |
7 | "path": "diaspora-project-site", | |
8 | "path_with_namespace": "diaspora/diaspora-project-site", | |
9 | "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", | |
10 | "web_url": "http://example.com/diaspora/diaspora-project-site" | |
11 | }, | |
12 | "milestone": { | |
13 | "id": 12, | |
14 | "title": "10.0" | |
15 | }, | |
16 | "lists" : [ | |
17 | { | |
18 | "id" : 1, | |
19 | "label" : { | |
20 | "name" : "Testing", | |
21 | "color" : "#F0AD4E", | |
22 | "description" : null | |
23 | }, | |
24 | "position" : 1 | |
25 | }, | |
26 | { | |
27 | "id" : 2, | |
28 | "label" : { | |
29 | "name" : "Ready", | |
30 | "color" : "#FF0000", | |
31 | "description" : null | |
32 | }, | |
33 | "position" : 2 | |
34 | }, | |
35 | { | |
36 | "id" : 3, | |
37 | "label" : { | |
38 | "name" : "Production", | |
39 | "color" : "#FF5F00", | |
40 | "description" : null | |
41 | }, | |
42 | "position" : 3 | |
43 | } | |
44 | ] | |
45 | } |
0 | [{ | |
1 | "name": "Dmitriy Zaporozhets", | |
2 | "email": "dmitriy.zaporozhets@gmail.com", | |
3 | "commits": 117, | |
4 | "additions": 2097, | |
5 | "deletions": 517 | |
6 | }, { | |
7 | "name": "Jacob Vosmaer", | |
8 | "email": "contact@jacobvosmaer.nl", | |
9 | "commits": 33, | |
10 | "additions": 338, | |
11 | "deletions": 244 | |
12 | }] |
0 | { | |
1 | "source_issue": { | |
2 | "id": 83, | |
3 | "iid": 11, | |
4 | "project_id": 4, | |
5 | "created_at": "2016-01-07T12:44:33.959Z", | |
6 | "title": "Issues with auth", | |
7 | "state": "opened", | |
8 | "assignees": [], | |
9 | "assignee": null, | |
10 | "labels": [ | |
11 | "bug" | |
12 | ], | |
13 | "author": { | |
14 | "name": "Alexandra Bashirian", | |
15 | "avatar_url": null, | |
16 | "state": "active", | |
17 | "web_url": "https://gitlab.example.com/eileen.lowe", | |
18 | "id": 18, | |
19 | "username": "eileen.lowe" | |
20 | }, | |
21 | "description": null, | |
22 | "updated_at": "2016-01-07T12:44:33.959Z", | |
23 | "milestone": null, | |
24 | "subscribed": true, | |
25 | "user_notes_count": 0, | |
26 | "due_date": null, | |
27 | "web_url": "http://example.com/example/example/issues/11", | |
28 | "confidential": false, | |
29 | "weight": null | |
30 | }, | |
31 | "target_issue": { | |
32 | "id": 84, | |
33 | "iid": 14, | |
34 | "project_id": 4, | |
35 | "created_at": "2016-01-07T12:44:33.959Z", | |
36 | "title": "Issues with auth", | |
37 | "state": "opened", | |
38 | "assignees": [], | |
39 | "assignee": null, | |
40 | "labels": [ | |
41 | "bug" | |
42 | ], | |
43 | "author": { | |
44 | "name": "Alexandra Bashirian", | |
45 | "avatar_url": null, | |
46 | "state": "active", | |
47 | "web_url": "https://gitlab.example.com/eileen.lowe", | |
48 | "id": 18, | |
49 | "username": "eileen.lowe" | |
50 | }, | |
51 | "description": null, | |
52 | "updated_at": "2016-01-07T12:44:33.959Z", | |
53 | "milestone": null, | |
54 | "subscribed": true, | |
55 | "user_notes_count": 0, | |
56 | "due_date": null, | |
57 | "web_url": "http://example.com/example/example/issues/14", | |
58 | "confidential": false, | |
59 | "weight": null | |
60 | } | |
61 | }⏎ |
0 | { | |
1 | "source_issue": { | |
2 | "id": 83, | |
3 | "iid": 11, | |
4 | "project_id": 4, | |
5 | "created_at": "2016-01-07T12:44:33.959Z", | |
6 | "title": "Issues with auth", | |
7 | "state": "opened", | |
8 | "assignees": [], | |
9 | "assignee": null, | |
10 | "labels": [ | |
11 | "bug" | |
12 | ], | |
13 | "author": { | |
14 | "name": "Alexandra Bashirian", | |
15 | "avatar_url": null, | |
16 | "state": "active", | |
17 | "web_url": "https://gitlab.example.com/eileen.lowe", | |
18 | "id": 18, | |
19 | "username": "eileen.lowe" | |
20 | }, | |
21 | "description": null, | |
22 | "updated_at": "2016-01-07T12:44:33.959Z", | |
23 | "milestone": null, | |
24 | "subscribed": true, | |
25 | "user_notes_count": 0, | |
26 | "due_date": null, | |
27 | "web_url": "http://example.com/example/example/issues/11", | |
28 | "confidential": false, | |
29 | "weight": null | |
30 | }, | |
31 | "target_issue": { | |
32 | "id": 84, | |
33 | "iid": 14, | |
34 | "project_id": 4, | |
35 | "created_at": "2016-01-07T12:44:33.959Z", | |
36 | "title": "Issues with auth", | |
37 | "state": "opened", | |
38 | "assignees": [], | |
39 | "assignee": null, | |
40 | "labels": [ | |
41 | "bug" | |
42 | ], | |
43 | "author": { | |
44 | "name": "Alexandra Bashirian", | |
45 | "avatar_url": null, | |
46 | "state": "active", | |
47 | "web_url": "https://gitlab.example.com/eileen.lowe", | |
48 | "id": 18, | |
49 | "username": "eileen.lowe" | |
50 | }, | |
51 | "description": null, | |
52 | "updated_at": "2016-01-07T12:44:33.959Z", | |
53 | "milestone": null, | |
54 | "subscribed": true, | |
55 | "user_notes_count": 0, | |
56 | "due_date": null, | |
57 | "web_url": "http://example.com/example/example/issues/14", | |
58 | "confidential": false, | |
59 | "weight": null | |
60 | } | |
61 | }⏎ |
0 | { | |
1 | "id": 30, | |
2 | "iid": 5, | |
3 | "group_id": 7, | |
4 | "title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.", | |
5 | "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.", | |
6 | "state": "opened", | |
7 | "web_url": "http://localhost:3001/groups/test/-/epics/5", | |
8 | "reference": "&5", | |
9 | "author":{ | |
10 | "id": 7, | |
11 | "name": "Pamella Huel", | |
12 | "username": "arnita", | |
13 | "state": "active", | |
14 | "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon", | |
15 | "web_url": "http://localhost:3001/arnita" | |
16 | }, | |
17 | "start_date": null, | |
18 | "start_date_is_fixed": false, | |
19 | "start_date_fixed": null, | |
20 | "start_date_from_inherited_source": null, | |
21 | "due_date": "2018-07-31", | |
22 | "due_date_is_fixed": false, | |
23 | "due_date_fixed": null, | |
24 | "due_date_from_inherited_source": "2018-07-31", | |
25 | "created_at": "2018-07-17T13:36:22.770Z", | |
26 | "updated_at": "2018-07-18T12:22:05.239Z", | |
27 | "closed_at": "2018-08-18T12:22:05.239Z", | |
28 | "labels": [], | |
29 | "upvotes": 4, | |
30 | "downvotes": 0, | |
31 | "subscribed": true | |
32 | } | |
33 |
0 | [ | |
1 | { | |
2 | "id": 29, | |
3 | "iid": 4, | |
4 | "group_id": 7, | |
5 | "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.", | |
6 | "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.", | |
7 | "state": "opened", | |
8 | "web_url": "http://localhost:3001/groups/test/-/epics/4", | |
9 | "reference": "&4", | |
10 | "author": { | |
11 | "id": 10, | |
12 | "name": "Lu Mayer", | |
13 | "username": "kam", | |
14 | "state": "active", | |
15 | "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon", | |
16 | "web_url": "http://localhost:3001/kam" | |
17 | }, | |
18 | "start_date": null, | |
19 | "start_date_is_fixed": false, | |
20 | "start_date_fixed": null, | |
21 | "start_date_from_inherited_source": null, | |
22 | "due_date": "2018-07-31", | |
23 | "due_date_is_fixed": false, | |
24 | "due_date_fixed": null, | |
25 | "due_date_from_inherited_source": "2018-07-31", | |
26 | "created_at": "2018-07-17T13:36:22.770Z", | |
27 | "updated_at": "2018-07-18T12:22:05.239Z", | |
28 | "closed_at": "2018-08-18T12:22:05.239Z", | |
29 | "labels": [], | |
30 | "upvotes": 4, | |
31 | "downvotes": 0 | |
32 | } | |
33 | ] | |
34 |
0 | { | |
1 | "name": "new_library", | |
2 | "state": "conditional", | |
3 | "gates": [ | |
4 | { | |
5 | "key": "boolean", | |
6 | "value": false | |
7 | }, | |
8 | { | |
9 | "key": "percentage_of_time", | |
10 | "value": 30 | |
11 | } | |
12 | ] | |
13 | } |
0 | [ | |
1 | { | |
2 | "name": "experimental_feature", | |
3 | "state": "off", | |
4 | "gates": [ | |
5 | { | |
6 | "key": "boolean", | |
7 | "value": false | |
8 | } | |
9 | ] | |
10 | }, | |
11 | { | |
12 | "name": "new_library", | |
13 | "state": "on", | |
14 | "gates": [ | |
15 | { | |
16 | "key": "boolean", | |
17 | "value": true | |
18 | } | |
19 | ] | |
20 | } | |
21 | ] |
0 | [ | |
1 | { | |
2 | "commit": { | |
3 | "id": "d42409d56517157c48bf3bd97d3f75974dde19fb", | |
4 | "message": "Add feature\n\nalso fix bug\n", | |
5 | "parent_ids": [ | |
6 | "cc6e14f9328fa6d7b5a0d3c30dc2002a3f2a3822" | |
7 | ], | |
8 | "authored_date": "2015-12-18T08:12:22.000Z", | |
9 | "author_name": "John Doe", | |
10 | "author_email": "john.doe@example.com", | |
11 | "committed_date": "2015-12-18T08:12:22.000Z", | |
12 | "committer_name": "John Doe", | |
13 | "committer_email": "john.doe@example.com" | |
14 | }, | |
15 | "lines": [ | |
16 | "require 'fileutils'", | |
17 | "require 'open3'" | |
18 | ] | |
19 | } | |
20 | ] | |
21 | ||
22 |
0 | {"cn":"all","group_access":50,"provider":"ldap"} |
0 | { | |
1 | "id": 1, | |
2 | "name": "group issue board", | |
3 | "group": { | |
4 | "id": 5, | |
5 | "name": "Documentcloud", | |
6 | "path": "documentcloud", | |
7 | "owner_id": null, | |
8 | "created_at": "2018-05-07T06:52:45.788Z", | |
9 | "updated_at": "2018-07-03T06:48:17.005Z", | |
10 | "description": "Consequatur aut a aperiam ut.", | |
11 | "avatar": { | |
12 | "url": null | |
13 | }, | |
14 | "membership_lock": false, | |
15 | "share_with_group_lock": false, | |
16 | "visibility_level": 20, | |
17 | "request_access_enabled": false, | |
18 | "ldap_sync_status": "ready", | |
19 | "ldap_sync_error": null, | |
20 | "ldap_sync_last_update_at": null, | |
21 | "ldap_sync_last_successful_update_at": null, | |
22 | "ldap_sync_last_sync_at": null, | |
23 | "lfs_enabled": null, | |
24 | "parent_id": null, | |
25 | "shared_runners_minutes_limit": null, | |
26 | "repository_size_limit": null, | |
27 | "require_two_factor_authentication": false, | |
28 | "two_factor_grace_period": 48, | |
29 | "plan_id": null, | |
30 | "project_creation_level": 2, | |
31 | "runners_token": "rgeeL-nv4wa9YdRvuMid" | |
32 | }, | |
33 | "milestone": { | |
34 | "id": 12, | |
35 | "title": "10.0" | |
36 | }, | |
37 | "lists" : [ | |
38 | { | |
39 | "id" : 1, | |
40 | "label" : { | |
41 | "name" : "Testing", | |
42 | "color" : "#F0AD4E", | |
43 | "description" : null | |
44 | }, | |
45 | "position" : 1 | |
46 | }, | |
47 | { | |
48 | "id" : 2, | |
49 | "label" : { | |
50 | "name" : "Ready", | |
51 | "color" : "#FF0000", | |
52 | "description" : null | |
53 | }, | |
54 | "position" : 2 | |
55 | }, | |
56 | { | |
57 | "id" : 3, | |
58 | "label" : { | |
59 | "name" : "Production", | |
60 | "color" : "#FF5F00", | |
61 | "description" : null | |
62 | }, | |
63 | "position" : 3 | |
64 | } | |
65 | ] | |
66 | } |
0 | { | |
1 | "id" : 1, | |
2 | "label" : { | |
3 | "name" : "Testing", | |
4 | "color" : "#F0AD4E", | |
5 | "description" : null | |
6 | }, | |
7 | "position" : 1 | |
8 | } |
0 | [ | |
1 | { | |
2 | "id" : 1, | |
3 | "label" : { | |
4 | "name" : "Testing", | |
5 | "color" : "#F0AD4E", | |
6 | "description" : null | |
7 | }, | |
8 | "position" : 1 | |
9 | }, | |
10 | { | |
11 | "id" : 2, | |
12 | "label" : { | |
13 | "name" : "Ready", | |
14 | "color" : "#FF0000", | |
15 | "description" : null | |
16 | }, | |
17 | "position" : 2 | |
18 | }, | |
19 | { | |
20 | "id" : 3, | |
21 | "label" : { | |
22 | "name" : "Production", | |
23 | "color" : "#FF5F00", | |
24 | "description" : null | |
25 | }, | |
26 | "position" : 3 | |
27 | } | |
28 | ] |
0 | [ | |
1 | { | |
2 | "id": 1, | |
3 | "name": "group issue board", | |
4 | "group": { | |
5 | "id": 5, | |
6 | "name": "Documentcloud", | |
7 | "path": "documentcloud", | |
8 | "owner_id": null, | |
9 | "created_at": "2018-05-07T06:52:45.788Z", | |
10 | "updated_at": "2018-07-03T06:48:17.005Z", | |
11 | "description": "Consequatur aut a aperiam ut.", | |
12 | "avatar": { | |
13 | "url": null | |
14 | }, | |
15 | "membership_lock": false, | |
16 | "share_with_group_lock": false, | |
17 | "visibility_level": 20, | |
18 | "request_access_enabled": false, | |
19 | "ldap_sync_status": "ready", | |
20 | "ldap_sync_error": null, | |
21 | "ldap_sync_last_update_at": null, | |
22 | "ldap_sync_last_successful_update_at": null, | |
23 | "ldap_sync_last_sync_at": null, | |
24 | "lfs_enabled": null, | |
25 | "parent_id": null, | |
26 | "shared_runners_minutes_limit": null, | |
27 | "repository_size_limit": null, | |
28 | "require_two_factor_authentication": false, | |
29 | "two_factor_grace_period": 48, | |
30 | "plan_id": null, | |
31 | "project_creation_level": 2, | |
32 | "runners_token": "rgeeL-nv4wa9YdRvuMid" | |
33 | }, | |
34 | "milestone": { | |
35 | "id": 12, | |
36 | "title": "10.0" | |
37 | }, | |
38 | "lists" : [ | |
39 | { | |
40 | "id" : 1, | |
41 | "label" : { | |
42 | "name" : "Testing", | |
43 | "color" : "#F0AD4E", | |
44 | "description" : null | |
45 | }, | |
46 | "position" : 1 | |
47 | }, | |
48 | { | |
49 | "id" : 2, | |
50 | "label" : { | |
51 | "name" : "Ready", | |
52 | "color" : "#FF0000", | |
53 | "description" : null | |
54 | }, | |
55 | "position" : 2 | |
56 | }, | |
57 | { | |
58 | "id" : 3, | |
59 | "label" : { | |
60 | "name" : "Production", | |
61 | "color" : "#FF5F00", | |
62 | "description" : null | |
63 | }, | |
64 | "position" : 3 | |
65 | } | |
66 | ] | |
67 | } | |
68 | ] |
0 | [ | |
1 | { | |
2 | "project_id" : 4, | |
3 | "milestone" : { | |
4 | "due_date" : null, | |
5 | "project_id" : 4, | |
6 | "state" : "closed", | |
7 | "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", | |
8 | "iid" : 3, | |
9 | "id" : 11, | |
10 | "title" : "v3.0", | |
11 | "created_at" : "2016-01-04T15:31:39.788Z", | |
12 | "updated_at" : "2016-01-04T15:31:39.788Z" | |
13 | }, | |
14 | "author" : { | |
15 | "state" : "active", | |
16 | "web_url" : "https://gitlab.example.com/root", | |
17 | "avatar_url" : null, | |
18 | "username" : "root", | |
19 | "id" : 1, | |
20 | "name" : "Administrator" | |
21 | }, | |
22 | "description" : "Omnis vero earum sunt corporis dolor et placeat.", | |
23 | "state" : "closed", | |
24 | "iid" : 1, | |
25 | "assignees" : [{ | |
26 | "avatar_url" : null, | |
27 | "web_url" : "https://gitlab.example.com/lennie", | |
28 | "state" : "active", | |
29 | "username" : "lennie", | |
30 | "id" : 9, | |
31 | "name" : "Dr. Luella Kovacek" | |
32 | }], | |
33 | "assignee" : { | |
34 | "avatar_url" : null, | |
35 | "web_url" : "https://gitlab.example.com/lennie", | |
36 | "state" : "active", | |
37 | "username" : "lennie", | |
38 | "id" : 9, | |
39 | "name" : "Dr. Luella Kovacek" | |
40 | }, | |
41 | "labels" : [], | |
42 | "id" : 41, | |
43 | "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.", | |
44 | "updated_at" : "2016-01-04T15:31:46.176Z", | |
45 | "created_at" : "2016-01-04T15:31:46.176Z", | |
46 | "closed_at" : null, | |
47 | "user_notes_count": 1, | |
48 | "due_date": null, | |
49 | "web_url": "http://example.com/example/example/issues/1", | |
50 | "time_stats": { | |
51 | "time_estimate": 0, | |
52 | "total_time_spent": 0, | |
53 | "human_time_estimate": null, | |
54 | "human_total_time_spent": null | |
55 | }, | |
56 | "confidential": false, | |
57 | "discussion_locked": false | |
58 | }, | |
59 | { | |
60 | "project_id" : 4, | |
61 | "milestone" : { | |
62 | "due_date" : null, | |
63 | "project_id" : 4, | |
64 | "state" : "closed", | |
65 | "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", | |
66 | "iid" : 3, | |
67 | "id" : 11, | |
68 | "title" : "v3.0", | |
69 | "created_at" : "2016-01-04T15:31:39.788Z", | |
70 | "updated_at" : "2016-01-04T15:31:39.788Z" | |
71 | }, | |
72 | "author" : { | |
73 | "state" : "active", | |
74 | "web_url" : "https://gitlab.example.com/root", | |
75 | "avatar_url" : null, | |
76 | "username" : "root", | |
77 | "id" : 1, | |
78 | "name" : "Administrator" | |
79 | }, | |
80 | "description" : "different", | |
81 | "state" : "closed", | |
82 | "iid" : 1, | |
83 | "assignees" : [{ | |
84 | "avatar_url" : null, | |
85 | "web_url" : "https://gitlab.example.com/lennie", | |
86 | "state" : "active", | |
87 | "username" : "lennie", | |
88 | "id" : 9, | |
89 | "name" : "Dr. Luella Kovacek" | |
90 | }], | |
91 | "assignee" : { | |
92 | "avatar_url" : null, | |
93 | "web_url" : "https://gitlab.example.com/lennie", | |
94 | "state" : "active", | |
95 | "username" : "lennie", | |
96 | "id" : 9, | |
97 | "name" : "Dr. Luella Kovacek" | |
98 | }, | |
99 | "labels" : [], | |
100 | "id" : 41, | |
101 | "title" : "different", | |
102 | "updated_at" : "2016-01-04T15:31:46.176Z", | |
103 | "created_at" : "2016-01-04T15:31:46.176Z", | |
104 | "closed_at" : null, | |
105 | "user_notes_count": 1, | |
106 | "due_date": null, | |
107 | "web_url": "http://example.com/example/example/issues/1", | |
108 | "time_stats": { | |
109 | "time_estimate": 0, | |
110 | "total_time_spent": 0, | |
111 | "human_time_estimate": null, | |
112 | "human_total_time_spent": null | |
113 | }, | |
114 | "confidential": false, | |
115 | "discussion_locked": false | |
116 | } | |
117 | ]⏎ |
0 | { | |
1 | "name": "Backlog", | |
2 | "color": "#DD10AA", | |
3 | "open_issues_count": 72, | |
4 | "closed_issues_count": 72, | |
5 | "open_merge_requests_count": 4, | |
6 | "subscribed": true | |
7 | } |
0 | { | |
1 | "name": "Backlog", | |
2 | "color": "#DD10AA", | |
3 | "open_issues_count": 72, | |
4 | "closed_issues_count": 72, | |
5 | "open_merge_requests_count": 4, | |
6 | "subscribed": false | |
7 | } |
0 | [ | |
1 | { | |
2 | "name": "Backlog", | |
3 | "color": "#DD10AA", | |
4 | "open_issues_count": 72, | |
5 | "closed_issues_count": 72, | |
6 | "open_merge_requests_count": 4, | |
7 | "subscribed": true | |
8 | }, | |
9 | { | |
10 | "name": "Documentation", | |
11 | "color": "#1E80DD", | |
12 | "open_issues_count": 42, | |
13 | "closed_issues_count": 42, | |
14 | "open_merge_requests_count": 6, | |
15 | "subscribed": true | |
16 | } | |
17 | ] |
0 | [{"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}] |
0 | { | |
1 | "status": "invalid", | |
2 | "errors": [ | |
3 | "variables config should be a hash of key value pairs" | |
4 | ] | |
5 | } |
0 | { "html": "<p dir=\"auto\">Hello world! <gl-emoji title=\"party popper\" data-name=\"tada\" data-unicode-version=\"6.0\">🎉</gl-emoji></p>" } |
0 | [ | |
1 | { | |
2 | "id": 1, | |
3 | "name": "John Doe1", | |
4 | "username": "user1", | |
5 | "state": "active", | |
6 | "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon", | |
7 | "web_url": "http://localhost/user1" | |
8 | }, | |
9 | { | |
10 | "id": 2, | |
11 | "name": "John Doe2", | |
12 | "username": "user2", | |
13 | "state": "active", | |
14 | "avatar_url": "http://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80&d=identicon", | |
15 | "web_url": "http://localhost/user2" | |
16 | } | |
17 | ]⏎ |
0 | {"id":3,"code":"gitlab","name":"Gitlab","description":null,"path":"gitlab","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"public":false,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:58Z"}⏎ | |
0 | {"id":3,"code":"gitlab","name":"Gitlab","description":null,"path":"gitlab","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"visibility":"private","issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:58Z"}⏎ |
0 | { | |
1 | "id": 3, | |
2 | "description": null, | |
3 | "default_branch": "master", | |
4 | "public": false, | |
5 | "visibility_level": 10, | |
6 | "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", | |
7 | "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", | |
8 | "web_url":"http://git.gitlab.com/root/gitlab", | |
9 | "tag_list": [ | |
10 | ||
11 | ], | |
12 | "name": "GitLab Community Edition", | |
13 | "name_with_namespace": "GitLab / GitLab Community Edition", | |
14 | "path": "gitlab-ce", | |
15 | "path_with_namespace": "gitlab/gitlab-ce", | |
16 | "issues_enabled": true, | |
17 | "open_issues_count": 1, | |
18 | "merge_requests_enabled": true, | |
19 | "builds_enabled": true, | |
20 | "wiki_enabled": true, | |
21 | "snippets_enabled": false, | |
22 | "container_registry_enabled": false, | |
23 | "created_at": "2013-09-30T13:46:02Z", | |
24 | "last_activity_at": "2013-09-30T13:46:02Z", | |
25 | "creator_id": 3, | |
26 | "namespace": { | |
27 | "created_at": "2013-09-30T13:46:02Z", | |
28 | "description": "", | |
29 | "id": 3, | |
30 | "name": "GitLab", | |
31 | "owner_id": 1, | |
32 | "path": "gitlab", | |
33 | "updated_at": "2013-09-30T13:46:02Z" | |
34 | }, | |
35 | "archived": true, | |
36 | "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", | |
37 | "shared_runners_enabled": true, | |
38 | "forks_count": 0, | |
39 | "star_count": 0, | |
40 | "public_builds": true, | |
41 | "shared_with_groups": [], | |
42 | "only_allow_merge_if_build_succeeds": false | |
43 | } |
0 | { | |
1 | "id":18, | |
2 | "name":"cluster-1", | |
3 | "created_at":"2019-01-02T20:18:12.563Z", | |
4 | "provider_type":"user", | |
5 | "platform_type":"kubernetes", | |
6 | "environment_scope":"*", | |
7 | "cluster_type":"project_type", | |
8 | "user": | |
9 | { | |
10 | "id":1, | |
11 | "name":"Administrator", | |
12 | "username":"root", | |
13 | "state":"active", | |
14 | "avatar_url":"https://www.gravatar.com/avatar/4249f4df72b..", | |
15 | "web_url":"https://gitlab.example.com/root" | |
16 | }, | |
17 | "platform_kubernetes": | |
18 | { | |
19 | "api_url":"https://104.197.68.152", | |
20 | "namespace":"cluster-1-namespace", | |
21 | "authorization_type":"rbac", | |
22 | "ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----" | |
23 | }, | |
24 | "project": | |
25 | { | |
26 | "id":26, | |
27 | "description":"", | |
28 | "name":"project-with-clusters-api", | |
29 | "name_with_namespace":"Administrator / project-with-clusters-api", | |
30 | "path":"project-with-clusters-api", | |
31 | "path_with_namespace":"root/project-with-clusters-api", | |
32 | "created_at":"2019-01-02T20:13:32.600Z", | |
33 | "default_branch":null, | |
34 | "tag_list":[], | |
35 | "ssh_url_to_repo":"ssh://gitlab.example.com/root/project-with-clusters-api.git", | |
36 | "http_url_to_repo":"https://gitlab.example.com/root/project-with-clusters-api.git", | |
37 | "web_url":"https://gitlab.example.com/root/project-with-clusters-api", | |
38 | "readme_url":null, | |
39 | "avatar_url":null, | |
40 | "star_count":0, | |
41 | "forks_count":0, | |
42 | "last_activity_at":"2019-01-02T20:13:32.600Z", | |
43 | "namespace": | |
44 | { | |
45 | "id":1, | |
46 | "name":"root", | |
47 | "path":"root", | |
48 | "kind":"user", | |
49 | "full_path":"root", | |
50 | "parent_id":null | |
51 | } | |
52 | } | |
53 | } |
0 | [ | |
1 | { | |
2 | "id":18, | |
3 | "name":"cluster-1", | |
4 | "created_at":"2019-01-02T20:18:12.563Z", | |
5 | "provider_type":"user", | |
6 | "platform_type":"kubernetes", | |
7 | "environment_scope":"*", | |
8 | "cluster_type":"project_type", | |
9 | "user": | |
10 | { | |
11 | "id":1, | |
12 | "name":"Administrator", | |
13 | "username":"root", | |
14 | "state":"active", | |
15 | "avatar_url":"https://www.gravatar.com/avatar/4249f4df72b..", | |
16 | "web_url":"https://gitlab.example.com/root" | |
17 | }, | |
18 | "platform_kubernetes": | |
19 | { | |
20 | "api_url":"https://104.197.68.152", | |
21 | "namespace":"cluster-1-namespace", | |
22 | "authorization_type":"rbac", | |
23 | "ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----" | |
24 | } | |
25 | } | |
26 | ] |
0 | [ | |
1 | { | |
2 | "type": "branch", | |
3 | "name": "12-1-stable" | |
4 | }, | |
5 | { | |
6 | "type": "branch", | |
7 | "name": "12-1-stable-prepare-rc23" | |
8 | }, | |
9 | { | |
10 | "type": "tag", | |
11 | "name": "v12.1.0" | |
12 | }, | |
13 | { | |
14 | "type": "tag", | |
15 | "name": "v12.1.0-rc22" | |
16 | }, | |
17 | { | |
18 | "type": "tag", | |
19 | "name": "v12.1.0-rc23" | |
20 | } | |
21 | ] |
11 | 11 | "blocked":false, |
12 | 12 | "created_at":"2012-09-17T09:41:56Z" |
13 | 13 | }, |
14 | "public":false, | |
14 | "visibility":"private", | |
15 | 15 | "issues_enabled":true, |
16 | 16 | "merge_requests_enabled":true, |
17 | 17 | "wall_enabled":true, |
0 | [ | |
1 | { | |
2 | "id": 84, | |
3 | "iid": 14, | |
4 | "issue_link_id": 1, | |
5 | "project_id": 4, | |
6 | "created_at": "2016-01-07T12:44:33.959Z", | |
7 | "title": "Issues with auth", | |
8 | "state": "opened", | |
9 | "assignees": [], | |
10 | "assignee": null, | |
11 | "labels": [ | |
12 | "bug" | |
13 | ], | |
14 | "author": { | |
15 | "name": "Alexandra Bashirian", | |
16 | "avatar_url": null, | |
17 | "state": "active", | |
18 | "web_url": "https://gitlab.example.com/eileen.lowe", | |
19 | "id": 18, | |
20 | "username": "eileen.lowe" | |
21 | }, | |
22 | "description": null, | |
23 | "updated_at": "2016-01-07T12:44:33.959Z", | |
24 | "milestone": null, | |
25 | "subscribed": true, | |
26 | "user_notes_count": 0, | |
27 | "due_date": null, | |
28 | "web_url": "http://example.com/example/example/issues/14", | |
29 | "confidential": false, | |
30 | "weight": null | |
31 | } | |
32 | ]⏎ |
0 | { | |
1 | "id": 2, | |
2 | "title": "New key name", | |
3 | "key": "ssh-rsa ...", | |
4 | "can_push": true, | |
5 | "created_at": "2013-09-22T18:34:32Z" | |
6 | } |
0 | { | |
1 | "tag_name":"v0.1", | |
2 | "description":"## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516", | |
3 | "name":"Awesome app v0.1 alpha", | |
4 | "description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRemove limit of 100 when searching repository code. !8671\u003c/li\u003e\n\u003cli\u003eShow error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\u003c/li\u003e\n\u003cli\u003eFix a bug where internal email pattern wasn't respected. !22516\u003c/li\u003e\n\u003c/ul\u003e", | |
5 | "created_at":"2019-01-03T01:55:18.203Z", | |
6 | "author":{ | |
7 | "id":1, | |
8 | "name":"Administrator", | |
9 | "username":"root", | |
10 | "state":"active", | |
11 | "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", | |
12 | "web_url":"http://localhost:3000/root" | |
13 | }, | |
14 | "commit":{ | |
15 | "id":"f8d3d94cbd347e924aa7b715845e439d00e80ca4", | |
16 | "short_id":"f8d3d94c", | |
17 | "title":"Initial commit", | |
18 | "created_at":"2019-01-03T01:53:28.000Z", | |
19 | "parent_ids":[ | |
20 | ||
21 | ], | |
22 | "message":"Initial commit", | |
23 | "author_name":"Administrator", | |
24 | "author_email":"admin@example.com", | |
25 | "authored_date":"2019-01-03T01:53:28.000Z", | |
26 | "committer_name":"Administrator", | |
27 | "committer_email":"admin@example.com", | |
28 | "committed_date":"2019-01-03T01:53:28.000Z" | |
29 | }, | |
30 | "assets":{ | |
31 | "count":4, | |
32 | "sources":[ | |
33 | { | |
34 | "format":"zip", | |
35 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.zip" | |
36 | }, | |
37 | { | |
38 | "format":"tar.gz", | |
39 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.gz" | |
40 | }, | |
41 | { | |
42 | "format":"tar.bz2", | |
43 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.bz2" | |
44 | }, | |
45 | { | |
46 | "format":"tar", | |
47 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar" | |
48 | } | |
49 | ], | |
50 | "links":[ | |
51 | ||
52 | ] | |
53 | } | |
54 | } |
0 | { | |
1 | "id":1, | |
2 | "name":"awesome-v0.2.dmg", | |
3 | "url":"http://192.168.10.15:3000", | |
4 | "external":true | |
5 | } |
0 | [ | |
1 | { | |
2 | "id":2, | |
3 | "name":"awesome-v0.2.msi", | |
4 | "url":"http://192.168.10.15:3000/msi", | |
5 | "external":true | |
6 | }, | |
7 | { | |
8 | "id":1, | |
9 | "name":"awesome-v0.2.dmg", | |
10 | "url":"http://192.168.10.15:3000", | |
11 | "external":true | |
12 | } | |
13 | ] |
0 | { | |
1 | "tag_name":"v0.1", | |
2 | "description":"## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516", | |
3 | "name":"Awesome app v0.1 alpha", | |
4 | "description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRemove limit of 100 when searching repository code. !8671\u003c/li\u003e\n\u003cli\u003eShow error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\u003c/li\u003e\n\u003cli\u003eFix a bug where internal email pattern wasn't respected. !22516\u003c/li\u003e\n\u003c/ul\u003e", | |
5 | "created_at":"2019-01-03T01:55:18.203Z", | |
6 | "author":{ | |
7 | "id":1, | |
8 | "name":"Administrator", | |
9 | "username":"root", | |
10 | "state":"active", | |
11 | "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", | |
12 | "web_url":"http://localhost:3000/root" | |
13 | }, | |
14 | "commit":{ | |
15 | "id":"f8d3d94cbd347e924aa7b715845e439d00e80ca4", | |
16 | "short_id":"f8d3d94c", | |
17 | "title":"Initial commit", | |
18 | "created_at":"2019-01-03T01:53:28.000Z", | |
19 | "parent_ids":[ | |
20 | ||
21 | ], | |
22 | "message":"Initial commit", | |
23 | "author_name":"Administrator", | |
24 | "author_email":"admin@example.com", | |
25 | "authored_date":"2019-01-03T01:53:28.000Z", | |
26 | "committer_name":"Administrator", | |
27 | "committer_email":"admin@example.com", | |
28 | "committed_date":"2019-01-03T01:53:28.000Z" | |
29 | }, | |
30 | "assets":{ | |
31 | "count":4, | |
32 | "sources":[ | |
33 | { | |
34 | "format":"zip", | |
35 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.zip" | |
36 | }, | |
37 | { | |
38 | "format":"tar.gz", | |
39 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.gz" | |
40 | }, | |
41 | { | |
42 | "format":"tar.bz2", | |
43 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.bz2" | |
44 | }, | |
45 | { | |
46 | "format":"tar", | |
47 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar" | |
48 | } | |
49 | ], | |
50 | "links":[ | |
51 | { | |
52 | "id":2, | |
53 | "name":"awesome-v0.2.msi", | |
54 | "url":"http://192.168.10.15:3000/msi", | |
55 | "external":true | |
56 | }, | |
57 | { | |
58 | "id":1, | |
59 | "name":"awesome-v0.2.dmg", | |
60 | "url":"http://192.168.10.15:3000", | |
61 | "external":true | |
62 | } | |
63 | ] | |
64 | } | |
65 | } |
0 | [ | |
1 | { | |
2 | "tag_name":"v0.2", | |
3 | "description":"## CHANGELOG\r\n\r\n- Escape label and milestone titles to prevent XSS in GFM autocomplete. !2740\r\n- Prevent private snippets from being embeddable.\r\n- Add subresources removal to member destroy service.", | |
4 | "name":"Awesome app v0.2 beta", | |
5 | "description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eEscape label and milestone titles to prevent XSS in GFM autocomplete. !2740\u003c/li\u003e\n\u003cli\u003ePrevent private snippets from being embeddable.\u003c/li\u003e\n\u003cli\u003eAdd subresources removal to member destroy service.\u003c/li\u003e\n\u003c/ul\u003e", | |
6 | "created_at":"2019-01-03T01:56:19.539Z", | |
7 | "author":{ | |
8 | "id":1, | |
9 | "name":"Administrator", | |
10 | "username":"root", | |
11 | "state":"active", | |
12 | "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", | |
13 | "web_url":"http://localhost:3000/root" | |
14 | }, | |
15 | "commit":{ | |
16 | "id":"079e90101242458910cccd35eab0e211dfc359c0", | |
17 | "short_id":"079e9010", | |
18 | "title":"Update README.md", | |
19 | "created_at":"2019-01-03T01:55:38.000Z", | |
20 | "parent_ids":[ | |
21 | "f8d3d94cbd347e924aa7b715845e439d00e80ca4" | |
22 | ], | |
23 | "message":"Update README.md", | |
24 | "author_name":"Administrator", | |
25 | "author_email":"admin@example.com", | |
26 | "authored_date":"2019-01-03T01:55:38.000Z", | |
27 | "committer_name":"Administrator", | |
28 | "committer_email":"admin@example.com", | |
29 | "committed_date":"2019-01-03T01:55:38.000Z" | |
30 | }, | |
31 | "assets":{ | |
32 | "count":6, | |
33 | "sources":[ | |
34 | { | |
35 | "format":"zip", | |
36 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.2/awesome-app-v0.2.zip" | |
37 | }, | |
38 | { | |
39 | "format":"tar.gz", | |
40 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.2/awesome-app-v0.2.tar.gz" | |
41 | }, | |
42 | { | |
43 | "format":"tar.bz2", | |
44 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.2/awesome-app-v0.2.tar.bz2" | |
45 | }, | |
46 | { | |
47 | "format":"tar", | |
48 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.2/awesome-app-v0.2.tar" | |
49 | } | |
50 | ], | |
51 | "links":[ | |
52 | { | |
53 | "id":2, | |
54 | "name":"awesome-v0.2.msi", | |
55 | "url":"http://192.168.10.15:3000/msi", | |
56 | "external":true | |
57 | }, | |
58 | { | |
59 | "id":1, | |
60 | "name":"awesome-v0.2.dmg", | |
61 | "url":"http://192.168.10.15:3000", | |
62 | "external":true | |
63 | } | |
64 | ] | |
65 | } | |
66 | }, | |
67 | { | |
68 | "tag_name":"v0.1", | |
69 | "description":"## CHANGELOG\r\n\r\n-Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516", | |
70 | "name":"Awesome app v0.1 alpha", | |
71 | "description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRemove limit of 100 when searching repository code. !8671\u003c/li\u003e\n\u003cli\u003eShow error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\u003c/li\u003e\n\u003cli\u003eFix a bug where internal email pattern wasn't respected. !22516\u003c/li\u003e\n\u003c/ul\u003e", | |
72 | "created_at":"2019-01-03T01:55:18.203Z", | |
73 | "author":{ | |
74 | "id":1, | |
75 | "name":"Administrator", | |
76 | "username":"root", | |
77 | "state":"active", | |
78 | "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", | |
79 | "web_url":"http://localhost:3000/root" | |
80 | }, | |
81 | "commit":{ | |
82 | "id":"f8d3d94cbd347e924aa7b715845e439d00e80ca4", | |
83 | "short_id":"f8d3d94c", | |
84 | "title":"Initial commit", | |
85 | "created_at":"2019-01-03T01:53:28.000Z", | |
86 | "parent_ids":[ | |
87 | ||
88 | ], | |
89 | "message":"Initial commit", | |
90 | "author_name":"Administrator", | |
91 | "author_email":"admin@example.com", | |
92 | "authored_date":"2019-01-03T01:53:28.000Z", | |
93 | "committer_name":"Administrator", | |
94 | "committer_email":"admin@example.com", | |
95 | "committed_date":"2019-01-03T01:53:28.000Z" | |
96 | }, | |
97 | "assets":{ | |
98 | "count":4, | |
99 | "sources":[ | |
100 | { | |
101 | "format":"zip", | |
102 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.zip" | |
103 | }, | |
104 | { | |
105 | "format":"tar.gz", | |
106 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.gz" | |
107 | }, | |
108 | { | |
109 | "format":"tar.bz2", | |
110 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.bz2" | |
111 | }, | |
112 | { | |
113 | "format":"tar", | |
114 | "url":"http://localhost:3000/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar" | |
115 | } | |
116 | ], | |
117 | "links":[ | |
118 | ||
119 | ] | |
120 | } | |
121 | } | |
122 | ] |
0 | { | |
1 | "id": 3, | |
2 | "description": null, | |
3 | "default_branch": "master", | |
4 | "public": false, | |
5 | "visibility_level": 10, | |
6 | "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", | |
7 | "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", | |
8 | "web_url":"http://git.gitlab.com/root/gitlab", | |
9 | "tag_list": [ | |
10 | ||
11 | ], | |
12 | "name": "GitLab Community Edition", | |
13 | "name_with_namespace": "GitLab / GitLab Community Edition", | |
14 | "path": "gitlab-ce", | |
15 | "path_with_namespace": "gitlab/gitlab-ce", | |
16 | "issues_enabled": true, | |
17 | "open_issues_count": 1, | |
18 | "merge_requests_enabled": true, | |
19 | "builds_enabled": true, | |
20 | "wiki_enabled": true, | |
21 | "snippets_enabled": false, | |
22 | "container_registry_enabled": false, | |
23 | "created_at": "2013-09-30T13:46:02Z", | |
24 | "last_activity_at": "2013-09-30T13:46:02Z", | |
25 | "creator_id": 3, | |
26 | "namespace": { | |
27 | "created_at": "2013-09-30T13:46:02Z", | |
28 | "description": "", | |
29 | "id": 3, | |
30 | "name": "GitLab", | |
31 | "owner_id": 1, | |
32 | "path": "gitlab", | |
33 | "updated_at": "2013-09-30T13:46:02Z" | |
34 | }, | |
35 | "archived": false, | |
36 | "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", | |
37 | "shared_runners_enabled": true, | |
38 | "forks_count": 0, | |
39 | "star_count": 0, | |
40 | "public_builds": true, | |
41 | "shared_with_groups": [], | |
42 | "only_allow_merge_if_build_succeeds": false | |
43 | } |
0 | [ | |
1 | { | |
2 | "id": 1, | |
3 | "name": "", | |
4 | "path": "group/project", | |
5 | "location": "gitlab.example.com:5000/group/project", | |
6 | "created_at": "2019-01-10T13:38:57.391Z" | |
7 | }, | |
8 | { | |
9 | "id": 2, | |
10 | "name": "releases", | |
11 | "path": "group/project/releases", | |
12 | "location": "gitlab.example.com:5000/group/project/releases", | |
13 | "created_at": "2019-01-10T13:39:08.229Z" | |
14 | } | |
15 | ] |
0 | { | |
1 | "name": "v10.0.0", | |
2 | "path": "group/project:latest", | |
3 | "location": "gitlab.example.com:5000/group/project:latest", | |
4 | "revision": "e9ed9d87c881d8c2fd3a31b41904d01ba0b836e7fd15240d774d811a1c248181", | |
5 | "short_revision": "e9ed9d87c", | |
6 | "digest": "sha256:c3490dcf10ffb6530c1303522a1405dfaf7daecd8f38d3e6a1ba19ea1f8a1751", | |
7 | "created_at": "2019-01-06T16:49:51.272+00:00", | |
8 | "total_size": 350224384 | |
9 | } |
0 | [ | |
1 | { | |
2 | "name": "A", | |
3 | "path": "group/project:A", | |
4 | "location": "gitlab.example.com:5000/group/project:A" | |
5 | }, | |
6 | { | |
7 | "name": "latest", | |
8 | "path": "group/project:latest", | |
9 | "location": "gitlab.example.com:5000/group/project:latest" | |
10 | } | |
11 | ] |
0 | { | |
1 | "id": 142, | |
2 | "user": { | |
3 | "id": 1, | |
4 | "name": "Administrator", | |
5 | "username": "root", | |
6 | "state": "active", | |
7 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
8 | "web_url": "http://gitlab.example.com/root" | |
9 | }, | |
10 | "created_at": "2018-08-20T13:38:20.077Z", | |
11 | "resource_type": "Issue", | |
12 | "resource_id": 253, | |
13 | "label": { | |
14 | "id": 73, | |
15 | "name": "a1", | |
16 | "color": "#34495E", | |
17 | "description": "" | |
18 | }, | |
19 | "action": "add" | |
20 | } |
0 | [ | |
1 | { | |
2 | "id": 142, | |
3 | "user": { | |
4 | "id": 1, | |
5 | "name": "Administrator", | |
6 | "username": "root", | |
7 | "state": "active", | |
8 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
9 | "web_url": "http://gitlab.example.com/root" | |
10 | }, | |
11 | "created_at": "2018-08-20T13:38:20.077Z", | |
12 | "resource_type": "Issue", | |
13 | "resource_id": 253, | |
14 | "label": { | |
15 | "id": 73, | |
16 | "name": "a1", | |
17 | "color": "#34495E", | |
18 | "description": "" | |
19 | }, | |
20 | "action": "add" | |
21 | }, | |
22 | { | |
23 | "id": 143, | |
24 | "user": { | |
25 | "id": 1, | |
26 | "name": "Administrator", | |
27 | "username": "root", | |
28 | "state": "active", | |
29 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
30 | "web_url": "http://gitlab.example.com/root" | |
31 | }, | |
32 | "created_at": "2018-08-20T13:38:20.077Z", | |
33 | "resource_type": "Issue", | |
34 | "resource_id": 253, | |
35 | "label": { | |
36 | "id": 74, | |
37 | "name": "p1", | |
38 | "color": "#0033CC", | |
39 | "description": "" | |
40 | }, | |
41 | "action": "remove" | |
42 | } | |
43 | ] |
0 | ||
1 | [ | |
2 | { | |
3 | "basename": "README", | |
4 | "data": "```\n\n## Installation\n\nQuick start using the [pre-built", | |
5 | "filename": "README.md", | |
6 | "id": null, | |
7 | "ref": "master", | |
8 | "startline": 46, | |
9 | "project_id": 6 | |
10 | } | |
11 | ] |
0 | ||
1 | [ | |
2 | { | |
3 | "id": "4109c2d872d5fdb1ed057400d103766aaea97f98", | |
4 | "short_id": "4109c2d8", | |
5 | "title": "goodbye $.browser", | |
6 | "created_at": "2013-02-18T22:02:54.000Z", | |
7 | "parent_ids": [ | |
8 | "59d05353ab575bcc2aa958fe1782e93297de64c9" | |
9 | ], | |
10 | "message": "goodbye $.browser\n", | |
11 | "author_name": "angus croll", | |
12 | "author_email": "anguscroll@gmail.com", | |
13 | "authored_date": "2013-02-18T22:02:54.000Z", | |
14 | "committer_name": "angus croll", | |
15 | "committer_email": "anguscroll@gmail.com", | |
16 | "committed_date": "2013-02-18T22:02:54.000Z", | |
17 | "project_id": 6 | |
18 | } | |
19 | ] |
0 | [ | |
1 | { | |
2 | "id": 83, | |
3 | "iid": 1, | |
4 | "project_id": 12, | |
5 | "title": "Add file", | |
6 | "description": "Add first file", | |
7 | "state": "opened", | |
8 | "created_at": "2018-01-24T06:02:15.514Z", | |
9 | "updated_at": "2018-02-06T12:36:23.263Z", | |
10 | "closed_at": null, | |
11 | "labels":[], | |
12 | "milestone": null, | |
13 | "assignees": [{ | |
14 | "id": 20, | |
15 | "name": "Ceola Deckow", | |
16 | "username": "sammy.collier", | |
17 | "state": "active", | |
18 | "avatar_url": "https://www.gravatar.com/avatar/c23d85a4f50e0ea76ab739156c639231?s=80&d=identicon", | |
19 | "web_url": "http://localhost:3000/sammy.collier" | |
20 | }], | |
21 | "author": { | |
22 | "id": 1, | |
23 | "name": "Administrator", | |
24 | "username": "root", | |
25 | "state": "active", | |
26 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
27 | "web_url": "http://localhost:3000/root" | |
28 | }, | |
29 | "assignee": { | |
30 | "id": 20, | |
31 | "name": "Ceola Deckow", | |
32 | "username": "sammy.collier", | |
33 | "state": "active", | |
34 | "avatar_url": "https://www.gravatar.com/avatar/c23d85a4f50e0ea76ab739156c639231?s=80&d=identicon", | |
35 | "web_url": "http://localhost:3000/sammy.collier" | |
36 | }, | |
37 | "user_notes_count": 0, | |
38 | "upvotes": 0, | |
39 | "downvotes": 0, | |
40 | "due_date": null, | |
41 | "confidential": false, | |
42 | "discussion_locked": null, | |
43 | "web_url": "http://localhost:3000/h5bp/7bp/subgroup-prj/issues/1", | |
44 | "time_stats": { | |
45 | "time_estimate": 0, | |
46 | "total_time_spent": 0, | |
47 | "human_time_estimate": null, | |
48 | "human_total_time_spent": null | |
49 | } | |
50 | } | |
51 | ] |
0 | [ | |
1 | { | |
2 | "id": 56, | |
3 | "iid": 8, | |
4 | "project_id": 6, | |
5 | "title": "Add first file", | |
6 | "description": "This is a test MR to add file", | |
7 | "state": "opened", | |
8 | "created_at": "2018-01-22T14:21:50.830Z", | |
9 | "updated_at": "2018-02-06T12:40:33.295Z", | |
10 | "target_branch": "master", | |
11 | "source_branch": "jaja-test", | |
12 | "upvotes": 0, | |
13 | "downvotes": 0, | |
14 | "author": { | |
15 | "id": 1, | |
16 | "name": "Administrator", | |
17 | "username": "root", | |
18 | "state": "active", | |
19 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
20 | "web_url": "http://localhost:3000/root" | |
21 | }, | |
22 | "assignee": { | |
23 | "id": 5, | |
24 | "name": "Jacquelyn Kutch", | |
25 | "username": "abigail", | |
26 | "state": "active", | |
27 | "avatar_url": "https://www.gravatar.com/avatar/3138c66095ee4bd11a508c2f7f7772da?s=80&d=identicon", | |
28 | "web_url": "http://localhost:3000/abigail" | |
29 | }, | |
30 | "source_project_id": 6, | |
31 | "target_project_id": 6, | |
32 | "labels": [ | |
33 | "ruby", | |
34 | "tests" | |
35 | ], | |
36 | "work_in_progress": false, | |
37 | "milestone": { | |
38 | "id": 13, | |
39 | "iid": 3, | |
40 | "project_id": 6, | |
41 | "title": "v2.0", | |
42 | "description": "Qui aut qui eos dolor beatae itaque tempore molestiae.", | |
43 | "state": "active", | |
44 | "created_at": "2017-09-05T07:58:29.099Z", | |
45 | "updated_at": "2017-09-05T07:58:29.099Z", | |
46 | "due_date": null, | |
47 | "start_date": null | |
48 | }, | |
49 | "merge_when_pipeline_succeeds": false, | |
50 | "merge_status": "can_be_merged", | |
51 | "sha": "78765a2d5e0a43585945c58e61ba2f822e4d090b", | |
52 | "merge_commit_sha": null, | |
53 | "user_notes_count": 0, | |
54 | "discussion_locked": null, | |
55 | "should_remove_source_branch": null, | |
56 | "force_remove_source_branch": true, | |
57 | "web_url": "http://localhost:3000/twitter/flight/merge_requests/8", | |
58 | "time_stats": { | |
59 | "time_estimate": 0, | |
60 | "total_time_spent": 0, | |
61 | "human_time_estimate": null, | |
62 | "human_total_time_spent": null | |
63 | } | |
64 | } | |
65 | ] |
0 | [ | |
1 | { | |
2 | "id": 44, | |
3 | "iid": 1, | |
4 | "project_id": 12, | |
5 | "title": "next release", | |
6 | "description": "Next release milestone", | |
7 | "state": "active", | |
8 | "created_at": "2018-02-06T12:43:39.271Z", | |
9 | "updated_at": "2018-02-06T12:44:01.298Z", | |
10 | "due_date": "2018-04-18", | |
11 | "start_date": "2018-02-04" | |
12 | } | |
13 | ] |
0 | [ | |
1 | { | |
2 | "id": 191, | |
3 | "body": "Harum maxime consequuntur et et deleniti assumenda facilis.", | |
4 | "attachment": null, | |
5 | "author": { | |
6 | "id": 23, | |
7 | "name": "User 1", | |
8 | "username": "user1", | |
9 | "state": "active", | |
10 | "avatar_url": "https://www.gravatar.com/avatar/111d68d06e2d317b5a59c2c6c5bad808?s=80&d=identicon", | |
11 | "web_url": "http://localhost:3000/user1" | |
12 | }, | |
13 | "created_at": "2017-09-05T08:01:32.068Z", | |
14 | "updated_at": "2017-09-05T08:01:32.068Z", | |
15 | "system": false, | |
16 | "noteable_id": 22, | |
17 | "noteable_type": "Issue", | |
18 | "noteable_iid": 2 | |
19 | } | |
20 | ] |
0 | [ | |
1 | { | |
2 | "id": 6, | |
3 | "description": "Nobis sed ipsam vero quod cupiditate veritatis hic.", | |
4 | "name": "Flight", | |
5 | "name_with_namespace": "Twitter / Flight", | |
6 | "path": "flight", | |
7 | "path_with_namespace": "twitter/flight", | |
8 | "created_at": "2017-09-05T07:58:01.621Z", | |
9 | "default_branch": "master", | |
10 | "tag_list":[], | |
11 | "ssh_url_to_repo": "ssh://jarka@localhost:2222/twitter/flight.git", | |
12 | "http_url_to_repo": "http://localhost:3000/twitter/flight.git", | |
13 | "web_url": "http://localhost:3000/twitter/flight", | |
14 | "avatar_url": null, | |
15 | "star_count": 0, | |
16 | "forks_count": 0, | |
17 | "last_activity_at": "2018-01-31T09:56:30.902Z" | |
18 | } | |
19 | ] |
0 | [ | |
1 | { | |
2 | "id": 50, | |
3 | "title": "Sample file", | |
4 | "file_name": "file.rb", | |
5 | "description": "Simple ruby file", | |
6 | "author": { | |
7 | "id": 1, | |
8 | "name": "Administrator", | |
9 | "username": "root", | |
10 | "state": "active", | |
11 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
12 | "web_url": "http://localhost:3000/root" | |
13 | }, | |
14 | "updated_at": "2018-02-06T12:49:29.104Z", | |
15 | "created_at": "2017-11-28T08:20:18.071Z", | |
16 | "project_id": 9, | |
17 | "web_url": "http://localhost:3000/root/jira-test/snippets/50" | |
18 | } | |
19 | ] |
0 | [ | |
1 | { | |
2 | "id": 50, | |
3 | "title": "Sample file", | |
4 | "file_name": "file.rb", | |
5 | "description": "Simple ruby file", | |
6 | "author": { | |
7 | "id": 1, | |
8 | "name": "Administrator", | |
9 | "username": "root", | |
10 | "state": "active", | |
11 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
12 | "web_url": "http://localhost:3000/root" | |
13 | }, | |
14 | "updated_at": "2018-02-06T12:49:29.104Z", | |
15 | "created_at": "2017-11-28T08:20:18.071Z", | |
16 | "project_id": 9, | |
17 | "web_url": "http://localhost:3000/root/jira-test/snippets/50" | |
18 | } | |
19 | ] |
0 | ||
1 | [ | |
2 | { | |
3 | "basename": "home", | |
4 | "data": "hello\n\nand bye\n\nend", | |
5 | "filename": "home.md", | |
6 | "id": null, | |
7 | "ref": "master", | |
8 | "startline": 5, | |
9 | "project_id": 6 | |
10 | } | |
11 | ] |
0 | { | |
1 | "id": 1, | |
2 | "project": { | |
3 | "id": 5, | |
4 | "name": "Diaspora Project Site", | |
5 | "name_with_namespace": "Diaspora / Diaspora Project Site", | |
6 | "path": "diaspora-project-site", | |
7 | "path_with_namespace": "diaspora/diaspora-project-site", | |
8 | "created_at": "2018-07-03T05:48:49.982Z", | |
9 | "default_branch": null, | |
10 | "tag_list": [], | |
11 | "ssh_url_to_repo": "ssh://user@example.com/diaspora/diaspora-project-site.git", | |
12 | "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", | |
13 | "web_url": "http://example.com/diaspora/diaspora-project-site", | |
14 | "readme_url": null, | |
15 | "avatar_url": null, | |
16 | "star_count": 0, | |
17 | "forks_count": 0, | |
18 | "last_activity_at": "2018-07-03T05:48:49.982Z" | |
19 | }, | |
20 | "lists": [], | |
21 | "name": "new_name", | |
22 | "group": null, | |
23 | "milestone": { | |
24 | "id": 43, | |
25 | "iid": 1, | |
26 | "project_id": 15, | |
27 | "title": "Milestone 1", | |
28 | "description": "Milestone 1 desc", | |
29 | "state": "active", | |
30 | "created_at": "2018-07-03T06:36:42.618Z", | |
31 | "updated_at": "2018-07-03T06:36:42.618Z", | |
32 | "due_date": null, | |
33 | "start_date": null, | |
34 | "web_url": "http://example.com/root/board1/milestones/1" | |
35 | }, | |
36 | "assignee": { | |
37 | "id": 1, | |
38 | "name": "Administrator", | |
39 | "username": "root", | |
40 | "state": "active", | |
41 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
42 | "web_url": "http://example.com/root" | |
43 | }, | |
44 | "labels": [{ | |
45 | "id": 10, | |
46 | "name": "Doing", | |
47 | "color": "#5CB85C", | |
48 | "description": null | |
49 | }], | |
50 | "weight": 4 | |
51 | } |
0 | { | |
1 | "id": 1, | |
2 | "project": null, | |
3 | "lists": [], | |
4 | "name": "new_name", | |
5 | "group": { | |
6 | "id": 5, | |
7 | "name": "Documentcloud", | |
8 | "path": "documentcloud", | |
9 | "owner_id": null, | |
10 | "created_at": "2018-05-07T06:52:45.788Z", | |
11 | "updated_at": "2018-07-03T06:48:17.005Z", | |
12 | "description": "Consequatur aut a aperiam ut.", | |
13 | "avatar": { | |
14 | "url": null | |
15 | }, | |
16 | "membership_lock": false, | |
17 | "share_with_group_lock": false, | |
18 | "visibility_level": 20, | |
19 | "request_access_enabled": false, | |
20 | "ldap_sync_status": "ready", | |
21 | "ldap_sync_error": null, | |
22 | "ldap_sync_last_update_at": null, | |
23 | "ldap_sync_last_successful_update_at": null, | |
24 | "ldap_sync_last_sync_at": null, | |
25 | "lfs_enabled": null, | |
26 | "parent_id": null, | |
27 | "shared_runners_minutes_limit": null, | |
28 | "repository_size_limit": null, | |
29 | "require_two_factor_authentication": false, | |
30 | "two_factor_grace_period": 48, | |
31 | "plan_id": null, | |
32 | "project_creation_level": 2, | |
33 | "runners_token": "rgeeL-nv3wa6YdRvuMid" | |
34 | }, | |
35 | "milestone": { | |
36 | "id": 44, | |
37 | "iid": 1, | |
38 | "group_id": 5, | |
39 | "title": "Group Milestone", | |
40 | "description": "Group Milestone Desc", | |
41 | "state": "active", | |
42 | "created_at": "2018-07-03T07:15:19.271Z", | |
43 | "updated_at": "2018-07-03T07:15:19.271Z", | |
44 | "due_date": null, | |
45 | "start_date": null, | |
46 | "web_url": "http://example.com/groups/documentcloud/-/milestones/1" | |
47 | }, | |
48 | "assignee": { | |
49 | "id": 1, | |
50 | "name": "Administrator", | |
51 | "username": "root", | |
52 | "state": "active", | |
53 | "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
54 | "web_url": "http://example.com/root" | |
55 | }, | |
56 | "labels": [{ | |
57 | "id": 11, | |
58 | "name": "GroupLabel", | |
59 | "color": "#428BCA", | |
60 | "description": "" | |
61 | }], | |
62 | "weight": 4 | |
63 | } |
16 | 16 | it 'returns true when command is valid' do |
17 | 17 | expect(described_class).to be_valid_command('merge_requests') |
18 | 18 | end |
19 | ||
19 | 20 | it 'returns false when command is NOT valid' do |
20 | 21 | expect(described_class).not_to be_valid_command('mmmmmerge_requests') |
21 | 22 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | it { is_expected.to respond_to :application_settings } | |
6 | it { is_expected.to respond_to :edit_application_settings } | |
7 | ||
8 | describe '.application_settings' do | |
9 | before do | |
10 | stub_get('/application/settings', 'application_settings') | |
11 | @application_settings = Gitlab.application_settings | |
12 | end | |
13 | ||
14 | it 'gets the correct resource' do | |
15 | expect(a_get('/application/settings')).to have_been_made | |
16 | end | |
17 | ||
18 | it 'returns a paginated response of projects' do | |
19 | expect(@application_settings).to be_a Gitlab::ObjectifiedHash | |
20 | expect(@application_settings.default_projects_limit).to eq(100_000) | |
21 | end | |
22 | end | |
23 | ||
24 | describe '.edit_application_settings' do | |
25 | before do | |
26 | stub_put('/application/settings', 'application_settings').with(body: { signup_enabled: true }) | |
27 | @edited_application_settings = Gitlab.edit_application_settings(signup_enabled: true) | |
28 | end | |
29 | ||
30 | it 'gets the correct resource' do | |
31 | expect(a_put('/application/settings').with(body: { signup_enabled: true })).to have_been_made | |
32 | end | |
33 | ||
34 | it 'returns information about an edited project' do | |
35 | expect(@edited_application_settings.signup_enabled).to eq(true) | |
36 | end | |
37 | end | |
38 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.avatar' do | |
6 | before do | |
7 | stub_get('/avatar', 'avatar').with(query: { email: 'admin@example.com', size: 32 }) | |
8 | @avatar = Gitlab.avatar(email: 'admin@example.com', size: 32) | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/avatar') | |
13 | .with(query: { email: 'admin@example.com', size: 32 })).to have_been_made | |
14 | end | |
15 | end | |
16 | end |
14 | 14 | |
15 | 15 | it "returns a paginated response of project's boards" do |
16 | 16 | expect(@boards).to be_a Gitlab::PaginatedResponse |
17 | end | |
18 | end | |
19 | ||
20 | describe '.board' do | |
21 | before do | |
22 | stub_get('/projects/5/boards/1', 'board') | |
23 | @board = Gitlab.board(5, 1) | |
24 | end | |
25 | ||
26 | it 'gets the correct resource' do | |
27 | expect(a_get('/projects/5/boards/1')).to have_been_made | |
28 | end | |
29 | ||
30 | it 'returns information about the board' do | |
31 | expect(@board.id).to eq(1) | |
32 | expect(@board.project.id).to eq(5) | |
33 | end | |
34 | end | |
35 | ||
36 | describe '.create_board' do | |
37 | before do | |
38 | stub_post('/projects/5/boards', 'board') | |
39 | @board = Gitlab.create_board(5, 'project issue board') | |
40 | end | |
41 | ||
42 | it 'gets the correct resource' do | |
43 | expect(a_post('/projects/5/boards') | |
44 | .with(body: { name: 'project issue board' })).to have_been_made | |
45 | end | |
46 | ||
47 | it 'returns information about a created board' do | |
48 | expect(@board.name).to eq('project issue board') | |
49 | expect(@board.project.id).to eq(5) | |
50 | end | |
51 | end | |
52 | ||
53 | describe '.edit_board' do | |
54 | before do | |
55 | stub_put('/projects/5/boards/1', 'updated_board') | |
56 | @board = Gitlab.edit_board(5, 1, name: 'new_name', milestone_id: 43, assignee_id: 1) | |
57 | end | |
58 | ||
59 | it 'gets the correct resource' do | |
60 | expect(a_put('/projects/5/boards/1') | |
61 | .with(body: { name: 'new_name', milestone_id: 43, assignee_id: 1 })).to have_been_made | |
62 | end | |
63 | ||
64 | it 'returns information about an edited board' do | |
65 | expect(@board.name).to eq('new_name') | |
66 | expect(@board.milestone.id).to eq(43) | |
67 | expect(@board.assignee.id).to eq(1) | |
68 | end | |
69 | end | |
70 | ||
71 | describe '.delete_board' do | |
72 | before do | |
73 | stub_delete('/projects/5/boards/1', 'empty') | |
74 | Gitlab.delete_board(5, 1) | |
75 | end | |
76 | ||
77 | it 'gets the correct resource' do | |
78 | expect(a_delete('/projects/5/boards/1')).to have_been_made | |
17 | 79 | end |
18 | 80 | end |
19 | 81 | |
58 | 120 | expect(a_post('/projects/3/boards/1/lists')).to have_been_made |
59 | 121 | end |
60 | 122 | |
61 | it 'returns information about a created board' do | |
123 | it 'returns information about a created board list' do | |
62 | 124 | expect(@board_list.position).to eq(1) |
63 | 125 | end |
64 | 126 | end |
73 | 135 | expect(a_put('/projects/3/boards/1/lists/1')).to have_been_made |
74 | 136 | end |
75 | 137 | |
76 | it 'returns information about an edited board' do | |
138 | it 'returns information about an edited board list' do | |
77 | 139 | expect(@board_list.id).to eq(1) |
78 | 140 | end |
79 | 141 | end |
14 | 14 | describe '.commits' do |
15 | 15 | before do |
16 | 16 | stub_get('/projects/3/repository/commits', 'project_commits') |
17 | .with(query: { ref_name: 'api' }) | |
18 | @commits = Gitlab.commits(3, ref_name: 'api') | |
17 | .with(query: { ref: 'api' }) | |
18 | @commits = Gitlab.commits(3, ref: 'api') | |
19 | 19 | end |
20 | 20 | |
21 | 21 | it 'gets the correct resource' do |
22 | 22 | expect(a_get('/projects/3/repository/commits') |
23 | .with(query: { ref_name: 'api' })).to have_been_made | |
23 | .with(query: { ref: 'api' })).to have_been_made | |
24 | 24 | end |
25 | 25 | |
26 | 26 | it 'returns a paginated response of repository commits' do |
42 | 42 | |
43 | 43 | it 'returns a repository commit' do |
44 | 44 | expect(@commit.id).to eq('6104942438c14ec7bd21c6cd5bd995272b3faff6') |
45 | end | |
46 | end | |
47 | ||
48 | describe '.commit_refs' do | |
49 | before do | |
50 | stub_get('/projects/3/repository/commits/0b4cd14ccc6a5c392526df719d29baf4315a4bbb/refs', 'project_commit_refs') | |
51 | @refs = Gitlab.commit_refs(3, '0b4cd14ccc6a5c392526df719d29baf4315a4bbb') | |
52 | end | |
53 | ||
54 | it 'gets the correct resource' do | |
55 | expect(a_get('/projects/3/repository/commits/0b4cd14ccc6a5c392526df719d29baf4315a4bbb/refs')) | |
56 | .to have_been_made | |
57 | end | |
58 | ||
59 | it 'returns an Array of refs' do | |
60 | expect(@refs.map(&:to_h)) | |
61 | .to include('type' => 'branch', 'name' => '12-1-stable') | |
62 | .and include('type' => 'tag', 'name' => 'v12.1.0') | |
45 | 63 | end |
46 | 64 | end |
47 | 65 |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.registry_repositories' do | |
6 | before do | |
7 | stub_get('/projects/3/registry/repositories', 'registry_repositories') | |
8 | @registry_repositories = Gitlab.registry_repositories(3) | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/projects/3/registry/repositories')).to have_been_made | |
13 | end | |
14 | ||
15 | it "returns a paginated response of project's registry repositories" do | |
16 | expect(@registry_repositories).to be_a Gitlab::PaginatedResponse | |
17 | end | |
18 | end | |
19 | ||
20 | describe '.delete_registry_repository' do | |
21 | before do | |
22 | stub_delete('/projects/3/registry/repositories/1', 'empty') | |
23 | Gitlab.delete_registry_repository(3, 1) | |
24 | end | |
25 | ||
26 | it 'gets the correct resource' do | |
27 | expect(a_delete('/projects/3/registry/repositories/1')).to have_been_made | |
28 | end | |
29 | end | |
30 | ||
31 | describe '.registry_repository_tags' do | |
32 | before do | |
33 | stub_get('/projects/3/registry/repositories/1/tags', 'registry_repository_tags') | |
34 | @registry_repository_tags = Gitlab.registry_repository_tags(3, 1) | |
35 | end | |
36 | ||
37 | it 'gets the correct resource' do | |
38 | expect(a_get('/projects/3/registry/repositories/1/tags')).to have_been_made | |
39 | end | |
40 | ||
41 | it "returns a paginated response of a registry repository's tags" do | |
42 | expect(@registry_repository_tags).to be_a Gitlab::PaginatedResponse | |
43 | end | |
44 | end | |
45 | ||
46 | describe '.registry_repository_tag' do | |
47 | before do | |
48 | stub_get('/projects/3/registry/repositories/1/tags/v10.0.0', 'registry_repository_tag') | |
49 | @registry_repository_tag = Gitlab.registry_repository_tag(3, 1, 'v10.0.0') | |
50 | end | |
51 | ||
52 | it 'gets the correct resource' do | |
53 | expect(a_get('/projects/3/registry/repositories/1/tags/v10.0.0')).to have_been_made | |
54 | end | |
55 | ||
56 | it 'returns correct information about the registry repository tag' do | |
57 | expect(@registry_repository_tag.name).to eq 'v10.0.0' | |
58 | end | |
59 | end | |
60 | ||
61 | describe '.delete_registry_repository_tag' do | |
62 | before do | |
63 | stub_delete('/projects/3/registry/repositories/1/tags/v10.0.0', 'empty') | |
64 | Gitlab.delete_registry_repository_tag(3, 1, 'v10.0.0') | |
65 | end | |
66 | ||
67 | it 'gets the correct resource' do | |
68 | expect(a_delete('/projects/3/registry/repositories/1/tags/v10.0.0')).to have_been_made | |
69 | end | |
70 | end | |
71 | ||
72 | describe '.bulk_delete_registry_repository_tags' do | |
73 | context 'when just name_regex provided for deletion' do | |
74 | before do | |
75 | stub_delete('/projects/3/registry/repositories/1/tags', 'empty').with(query: { name_regex: '.*' }) | |
76 | Gitlab.bulk_delete_registry_repository_tags(3, 1, name_regex: '.*') | |
77 | end | |
78 | ||
79 | it 'gets the correct resource' do | |
80 | expect(a_delete('/projects/3/registry/repositories/1/tags') | |
81 | .with(query: { name_regex: '.*' })).to have_been_made | |
82 | end | |
83 | end | |
84 | ||
85 | context 'when all options provided for deletion' do | |
86 | before do | |
87 | stub_delete('/projects/3/registry/repositories/1/tags', 'empty').with(query: { name_regex: '[0-9a-z]{40}', keep_n: 5, older_than: '1d' }) | |
88 | Gitlab.bulk_delete_registry_repository_tags(3, 1, name_regex: '[0-9a-z]{40}', keep_n: 5, older_than: '1d') | |
89 | end | |
90 | ||
91 | it 'gets the correct resource' do | |
92 | expect(a_delete('/projects/3/registry/repositories/1/tags') | |
93 | .with(query: { name_regex: '[0-9a-z]{40}', keep_n: 5, older_than: '1d' })).to have_been_made | |
94 | end | |
95 | end | |
96 | end | |
97 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.epics' do | |
6 | before do | |
7 | stub_get('/groups/1/epics', 'epics') | |
8 | @epics = Gitlab.epics(1) | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/groups/1/epics')).to have_been_made | |
13 | end | |
14 | ||
15 | it 'returns a paginated response of groups' do | |
16 | expect(@epics).to be_a Gitlab::PaginatedResponse | |
17 | end | |
18 | end | |
19 | ||
20 | describe '.epic' do | |
21 | before do | |
22 | stub_get('/groups/1/epics/2', 'epic') | |
23 | Gitlab.epic(1, 2) | |
24 | end | |
25 | ||
26 | it 'gets the correct resource' do | |
27 | expect(a_get('/groups/1/epics/2')).to have_been_made | |
28 | end | |
29 | end | |
30 | ||
31 | describe '.create_epic' do | |
32 | before do | |
33 | stub_post('/groups/1/epics', 'epic') | |
34 | Gitlab.create_epic(1, 'foo', description: 'bar') | |
35 | end | |
36 | ||
37 | it 'creates the right resource' do | |
38 | expect(a_post('/groups/1/epics') | |
39 | .with(body: { title: 'foo', description: 'bar' })).to have_been_made | |
40 | end | |
41 | end | |
42 | ||
43 | describe '.edit_epic' do | |
44 | before do | |
45 | stub_put('/groups/1/epics/2', 'epic') | |
46 | Gitlab.edit_epic(1, 2, title: 'mepmep') | |
47 | end | |
48 | ||
49 | it 'updates the correct resource' do | |
50 | expect(a_put('/groups/1/epics/2') | |
51 | .with(body: { title: 'mepmep' })).to have_been_made | |
52 | end | |
53 | end | |
54 | ||
55 | describe '.delete_epic' do | |
56 | before do | |
57 | stub_delete('/groups/1/epics/2', 'epic') | |
58 | Gitlab.delete_epic(1, 2) | |
59 | end | |
60 | ||
61 | it 'deletes the correct resource' do | |
62 | expect(a_delete('/groups/1/epics/2')).to have_been_made | |
63 | end | |
64 | end | |
65 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.features' do | |
6 | before do | |
7 | stub_get('/features', 'features') | |
8 | @features = Gitlab.features | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/features')).to have_been_made | |
13 | end | |
14 | ||
15 | it 'returns a paginated response of features' do | |
16 | expect(@features).to be_a Gitlab::PaginatedResponse | |
17 | end | |
18 | end | |
19 | ||
20 | describe '.set_feature' do | |
21 | context 'when setting boolean value' do | |
22 | before do | |
23 | stub_post('/features/new_library', 'feature') | |
24 | @feature = Gitlab.set_feature('new_library', true) | |
25 | end | |
26 | ||
27 | it 'gets the correct resource' do | |
28 | expect(a_post('/features/new_library') | |
29 | .with(body: { value: true })).to have_been_made | |
30 | end | |
31 | ||
32 | it 'returns information about the feature' do | |
33 | expect(@feature).to be_a Gitlab::ObjectifiedHash | |
34 | end | |
35 | end | |
36 | ||
37 | context 'when setting percentage-of-time gate value' do | |
38 | before do | |
39 | stub_post('/features/new_library', 'feature') | |
40 | @feature = Gitlab.set_feature('new_library', 30) | |
41 | end | |
42 | ||
43 | it 'gets the correct resource' do | |
44 | expect(a_post('/features/new_library') | |
45 | .with(body: { value: 30 })).to have_been_made | |
46 | end | |
47 | ||
48 | it 'returns information about the feature' do | |
49 | expect(@feature).to be_a Gitlab::ObjectifiedHash | |
50 | end | |
51 | end | |
52 | end | |
53 | ||
54 | describe '.delete_feature' do | |
55 | before do | |
56 | stub_delete('/features/new_library', 'empty') | |
57 | Gitlab.delete_feature('new_library') | |
58 | end | |
59 | ||
60 | it 'gets the correct resource' do | |
61 | expect(a_delete('/features/new_library')).to have_been_made | |
62 | end | |
63 | end | |
64 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.group_boards' do | |
6 | before do | |
7 | stub_get('/groups/5/boards', 'group_boards') | |
8 | @group_boards = Gitlab.group_boards(5) | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/groups/5/boards')).to have_been_made | |
13 | end | |
14 | ||
15 | it "returns a paginated response of group's boards" do | |
16 | expect(@group_boards).to be_a Gitlab::PaginatedResponse | |
17 | end | |
18 | end | |
19 | ||
20 | describe '.group_board' do | |
21 | before do | |
22 | stub_get('/groups/5/boards/1', 'group_board') | |
23 | @group_board = Gitlab.group_board(5, 1) | |
24 | end | |
25 | ||
26 | it 'gets the correct resource' do | |
27 | expect(a_get('/groups/5/boards/1')).to have_been_made | |
28 | end | |
29 | ||
30 | it 'returns correct information about a group issue board' do | |
31 | expect(@group_board.id).to eq 1 | |
32 | end | |
33 | end | |
34 | ||
35 | describe '.create_group_board' do | |
36 | before do | |
37 | stub_post('/groups/5/boards', 'group_board') | |
38 | @group_board = Gitlab.create_group_board(5, 'group issue board') | |
39 | end | |
40 | ||
41 | it 'gets the correct resource' do | |
42 | expect(a_post('/groups/5/boards') | |
43 | .with(body: { name: 'group issue board' })).to have_been_made | |
44 | end | |
45 | ||
46 | it 'returns information about a created group issue board' do | |
47 | expect(@group_board.name).to eq('group issue board') | |
48 | end | |
49 | end | |
50 | ||
51 | describe '.edit_group_board' do | |
52 | before do | |
53 | stub_put('/groups/5/boards/1', 'updated_group_board') | |
54 | @group_board = Gitlab.edit_group_board(5, 1, assignee_id: 1, milestone_id: 44) | |
55 | end | |
56 | ||
57 | it 'gets the correct resource' do | |
58 | expect(a_put('/groups/5/boards/1') | |
59 | .with(body: { assignee_id: 1, milestone_id: 44 })).to have_been_made | |
60 | end | |
61 | ||
62 | it 'returns information about an edited group issue board' do | |
63 | expect(@group_board.assignee.id).to eq(1) | |
64 | expect(@group_board.milestone.id).to eq(44) | |
65 | end | |
66 | end | |
67 | ||
68 | describe '.delete_group_board' do | |
69 | before do | |
70 | stub_delete('/groups/5/boards/1', 'empty') | |
71 | Gitlab.delete_group_board(5, 1) | |
72 | end | |
73 | ||
74 | it 'gets the correct resource' do | |
75 | expect(a_delete('/groups/5/boards/1')).to have_been_made | |
76 | end | |
77 | end | |
78 | ||
79 | describe '.group_board_lists' do | |
80 | before do | |
81 | stub_get('/groups/5/boards/1/lists', 'group_board_lists') | |
82 | @group_board_lists = Gitlab.group_board_lists(5, 1) | |
83 | end | |
84 | ||
85 | it 'gets the correct resource' do | |
86 | expect(a_get('/groups/5/boards/1/lists')).to have_been_made | |
87 | end | |
88 | ||
89 | it "returns a paginated response of group's board lists" do | |
90 | expect(@group_board_lists).to be_a Gitlab::PaginatedResponse | |
91 | end | |
92 | end | |
93 | ||
94 | describe '.group_board_list' do | |
95 | before do | |
96 | stub_get('/groups/5/boards/1/lists/1', 'group_board_list') | |
97 | @group_board_list = Gitlab.group_board_list(5, 1, 1) | |
98 | end | |
99 | ||
100 | it 'gets the correct resource' do | |
101 | expect(a_get('/groups/5/boards/1/lists/1')).to have_been_made | |
102 | end | |
103 | ||
104 | it 'returns correct information about a group issue board list' do | |
105 | expect(@group_board_list.id).to eq 1 | |
106 | end | |
107 | end | |
108 | ||
109 | describe '.create_group_board_list' do | |
110 | before do | |
111 | stub_post('/groups/5/boards/1/lists', 'group_board_list') | |
112 | @group_board_list = Gitlab.create_group_board_list(5, 1, 5) | |
113 | end | |
114 | ||
115 | it 'gets the correct resource' do | |
116 | expect(a_post('/groups/5/boards/1/lists') | |
117 | .with(body: { label_id: 5 })).to have_been_made | |
118 | end | |
119 | ||
120 | it 'returns information about a created group issue board list' do | |
121 | expect(@group_board_list.position).to eq(1) | |
122 | end | |
123 | end | |
124 | ||
125 | describe '.edit_group_board_list' do | |
126 | before do | |
127 | stub_put('/groups/5/boards/1/lists/1', 'group_board_list') | |
128 | @group_board_list = Gitlab.edit_group_board_list(5, 1, 1, position: 1) | |
129 | end | |
130 | ||
131 | it 'gets the correct resource' do | |
132 | expect(a_put('/groups/5/boards/1/lists/1') | |
133 | .with(body: { position: 1 })).to have_been_made | |
134 | end | |
135 | ||
136 | it 'returns information about an edited group issue board list' do | |
137 | expect(@group_board_list.position).to eq(1) | |
138 | end | |
139 | end | |
140 | ||
141 | describe '.delete_group_board_list' do | |
142 | before do | |
143 | stub_delete('/groups/5/boards/1/lists/1', 'empty') | |
144 | Gitlab.delete_group_board_list(5, 1, 1) | |
145 | end | |
146 | ||
147 | it 'gets the correct resource' do | |
148 | expect(a_delete('/groups/5/boards/1/lists/1')).to have_been_made | |
149 | end | |
150 | end | |
151 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.group_labels' do | |
6 | before do | |
7 | stub_get('/groups/3/labels', 'group_labels') | |
8 | @labels = Gitlab.group_labels(3) | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/groups/3/labels')).to have_been_made | |
13 | end | |
14 | ||
15 | it "returns a paginated response of group's labels" do | |
16 | expect(@labels).to be_a Gitlab::PaginatedResponse | |
17 | expect(@labels.first.name).to eq('Backlog') | |
18 | end | |
19 | end | |
20 | ||
21 | describe '.create_group_label' do | |
22 | before do | |
23 | stub_post('/groups/3/labels', 'group_label') | |
24 | @label = Gitlab.create_group_label(3, 'Backlog', '#DD10AA') | |
25 | end | |
26 | ||
27 | it 'gets the correct resource' do | |
28 | expect(a_post('/groups/3/labels') | |
29 | .with(body: { name: 'Backlog', color: '#DD10AA' })).to have_been_made | |
30 | end | |
31 | ||
32 | it 'returns information about a created label' do | |
33 | expect(@label.name).to eq('Backlog') | |
34 | expect(@label.color).to eq('#DD10AA') | |
35 | end | |
36 | end | |
37 | ||
38 | describe '.edit_group_label' do | |
39 | before do | |
40 | stub_put('/groups/3/labels', 'group_label') | |
41 | @label = Gitlab.edit_group_label(3, 'TODO', new_name: 'Backlog') | |
42 | end | |
43 | ||
44 | it 'gets the correct resource' do | |
45 | expect(a_put('/groups/3/labels') | |
46 | .with(body: { name: 'TODO', new_name: 'Backlog' })).to have_been_made | |
47 | end | |
48 | ||
49 | it 'returns information about an edited label' do | |
50 | expect(@label.name).to eq('Backlog') | |
51 | end | |
52 | end | |
53 | ||
54 | describe '.delete_group_label' do | |
55 | before do | |
56 | stub_delete('/groups/3/labels', 'label') | |
57 | @label = Gitlab.delete_group_label(3, 'Backlog') | |
58 | end | |
59 | ||
60 | it 'gets the correct resource' do | |
61 | expect(a_delete('/groups/3/labels') | |
62 | .with(body: { name: 'Backlog' })).to have_been_made | |
63 | end | |
64 | ||
65 | it 'returns information about a deleted snippet' do | |
66 | expect(@label.name).to eq('Backlog') | |
67 | end | |
68 | end | |
69 | ||
70 | describe '.subscribe_to_group_label' do | |
71 | before do | |
72 | stub_post('/groups/3/labels/Backlog/subscribe', 'group_label') | |
73 | @label = Gitlab.subscribe_to_group_label(3, 'Backlog') | |
74 | end | |
75 | ||
76 | it 'gets the correct resource' do | |
77 | expect(a_post('/groups/3/labels/Backlog/subscribe')).to have_been_made | |
78 | end | |
79 | ||
80 | it 'returns information about the label subscribed to' do | |
81 | expect(@label.name).to eq('Backlog') | |
82 | expect(@label.subscribed).to eq(true) | |
83 | end | |
84 | end | |
85 | ||
86 | describe '.unsubscribe_from_group_label' do | |
87 | before do | |
88 | stub_post('/groups/3/labels/Backlog/unsubscribe', 'group_label_unsubscribe') | |
89 | @label = Gitlab.unsubscribe_from_group_label(3, 'Backlog') | |
90 | end | |
91 | ||
92 | it 'gets the correct resource' do | |
93 | expect(a_post('/groups/3/labels/Backlog/unsubscribe')).to have_been_made | |
94 | end | |
95 | ||
96 | it 'returns information about the label subscribed to' do | |
97 | expect(@label.name).to eq('Backlog') | |
98 | expect(@label.subscribed).to eq(false) | |
99 | end | |
100 | end | |
101 | end |
18 | 18 | it 'returns a paginated response of groups' do |
19 | 19 | expect(@groups).to be_a Gitlab::PaginatedResponse |
20 | 20 | expect(@groups.first.path).to eq('threegroup') |
21 | end | |
22 | end | |
23 | ||
24 | describe '.group' do | |
25 | before do | |
26 | stub_get('/groups/3?with_projects=false', 'group') | |
27 | @group = Gitlab.group(3, with_projects: false) | |
28 | end | |
29 | ||
30 | it 'gets the correct resource' do | |
31 | expect(a_get('/groups/3?with_projects=false')).to have_been_made | |
21 | 32 | end |
22 | 33 | end |
23 | 34 | |
244 | 255 | end |
245 | 256 | end |
246 | 257 | end |
258 | ||
259 | describe '.group_issues' do | |
260 | before do | |
261 | stub_get('/groups/3/issues', 'group_issues') | |
262 | @issues = Gitlab.group_issues(3) | |
263 | end | |
264 | ||
265 | it 'gets the correct resource' do | |
266 | expect(a_get('/groups/3/issues')).to have_been_made | |
267 | end | |
268 | ||
269 | it "returns a paginated response of project's issues" do | |
270 | expect(@issues).to be_a Gitlab::PaginatedResponse | |
271 | expect(@issues.first.project_id).to eq(4) | |
272 | end | |
273 | end | |
274 | ||
275 | describe '.group_merge_requests' do | |
276 | before do | |
277 | stub_get('/groups/3/merge_requests', 'group_merge_requests') | |
278 | @merge_requests = Gitlab.group_merge_requests(3) | |
279 | end | |
280 | ||
281 | it 'gets the correct resource' do | |
282 | expect(a_get('/groups/3/merge_requests')).to have_been_made | |
283 | end | |
284 | ||
285 | it "returns information about a group's merge requests" do | |
286 | expect(@merge_requests).to be_a Gitlab::PaginatedResponse | |
287 | expect(@merge_requests.first.project_id).to eq(3) | |
288 | end | |
289 | end | |
290 | ||
291 | describe '.sync_ldap_group' do | |
292 | before do | |
293 | stub_post('/groups/1/ldap_sync', 'group_ldap_sync') | |
294 | Gitlab.sync_ldap_group(1) | |
295 | end | |
296 | ||
297 | it 'gets the correct resource' do | |
298 | expect(a_post('/groups/1/ldap_sync')).to have_been_made | |
299 | end | |
300 | end | |
301 | ||
302 | describe '.add_ldap_group_links' do | |
303 | before do | |
304 | stub_post('/groups/1/ldap_group_links', 'group_add_ldap_links') | |
305 | @ldap_link = Gitlab.add_ldap_group_links(1, 'all', 50, 'ldap') | |
306 | end | |
307 | ||
308 | it 'gets the correct resource' do | |
309 | expect(a_post('/groups/1/ldap_group_links') | |
310 | .with(body: { cn: 'all', group_access: 50, provider: 'ldap' })).to have_been_made | |
311 | end | |
312 | ||
313 | it 'returns information about the created ldap link' do | |
314 | expect(@ldap_link.cn).to eq('all') | |
315 | expect(@ldap_link.group_access).to eq(50) | |
316 | expect(@ldap_link.provider).to eq('ldap') | |
317 | end | |
318 | end | |
319 | ||
320 | describe '.delete_ldap_group_links' do | |
321 | before do | |
322 | stub_delete('/groups/1/ldap_group_links/ldap/all', 'group_delete_ldap_links') | |
323 | Gitlab.delete_ldap_group_links(1, 'all', 'ldap') | |
324 | end | |
325 | ||
326 | it 'gets the correct resource' do | |
327 | expect(a_delete('/groups/1/ldap_group_links/ldap/all')).to have_been_made | |
328 | end | |
329 | end | |
247 | 330 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | it { is_expected.to respond_to :issue_links } | |
6 | it { is_expected.to respond_to :create_issue_link } | |
7 | it { is_expected.to respond_to :delete_issue_link } | |
8 | ||
9 | describe '.issue_links' do | |
10 | before do | |
11 | stub_get('/projects/4/issues/14/links', 'project_issue_links') | |
12 | @issue_link = Gitlab.issue_links(4, 14) | |
13 | end | |
14 | ||
15 | it 'gets the correct resource' do | |
16 | expect(a_get('/projects/4/issues/14/links')).to have_been_made | |
17 | end | |
18 | ||
19 | it 'returns a paginated response of projects' do | |
20 | expect(@issue_link).to be_a Gitlab::PaginatedResponse | |
21 | expect(@issue_link.first.title).to eq('Issues with auth') | |
22 | expect(@issue_link.first.author.name).to eq('Alexandra Bashirian') | |
23 | end | |
24 | end | |
25 | ||
26 | describe '.create_issue_link' do | |
27 | before do | |
28 | stub_post('/projects/3/issues/14/links', 'create_issue_link') | |
29 | @issue_link = Gitlab.create_issue_link(3, 14, 4, 11) | |
30 | end | |
31 | ||
32 | it 'gets the correct resource' do | |
33 | expect(a_post('/projects/3/issues/14/links') | |
34 | .with(body: { target_project_id: 4, target_issue_iid: 11 })).to have_been_made | |
35 | end | |
36 | ||
37 | it 'returns information about a created issue' do | |
38 | expect(@issue_link.source_issue.iid).to eq(11) | |
39 | expect(@issue_link.target_issue.iid).to eq(14) | |
40 | end | |
41 | end | |
42 | ||
43 | describe '.delete_issue_link' do | |
44 | before do | |
45 | stub_delete('/projects/3/issues/14/links/1', 'delete_issue_link') | |
46 | @issue_link = Gitlab.delete_issue_link(3, 14, 1) | |
47 | end | |
48 | ||
49 | it 'deletes the correct resource' do | |
50 | expect(a_delete('/projects/3/issues/14/links/1')).to have_been_made | |
51 | end | |
52 | ||
53 | it 'returns information about the deleted issue link' do | |
54 | expect(@issue_link.source_issue.iid).to eq(11) | |
55 | expect(@issue_link.target_issue.iid).to eq(14) | |
56 | end | |
57 | end | |
58 | end |
236 | 236 | end |
237 | 237 | |
238 | 238 | describe '.add_time_spent_on_issue' do |
239 | before do | |
240 | stub_post('/projects/3/issues/33/add_spent_time', 'issue') | |
241 | @issue = Gitlab.add_time_spent_on_issue(3, 33, '3h30m') | |
242 | end | |
243 | ||
244 | it 'gets the correct resource' do | |
245 | expect(a_post('/projects/3/issues/33/add_spent_time') | |
246 | .with(body: { duration: '3h30m' })).to have_been_made | |
247 | end | |
248 | ||
249 | it 'returns information about the estimated issue' do | |
250 | expect(@issue.project_id).to eq(3) | |
251 | expect(@issue.assignee.name).to eq('Jack Smith') | |
239 | context 'with positive value' do | |
240 | before do | |
241 | stub_post('/projects/3/issues/33/add_spent_time', 'issue') | |
242 | @issue = Gitlab.add_time_spent_on_issue(3, 33, '3h30m') | |
243 | end | |
244 | ||
245 | it 'gets the correct resource' do | |
246 | expect(a_post('/projects/3/issues/33/add_spent_time') | |
247 | .with(body: { duration: '3h30m' })).to have_been_made | |
248 | end | |
249 | ||
250 | it 'returns information about the estimated issue' do | |
251 | expect(@issue.project_id).to eq(3) | |
252 | expect(@issue.assignee.name).to eq('Jack Smith') | |
253 | end | |
254 | end | |
255 | ||
256 | context 'with negative value' do | |
257 | before do | |
258 | stub_post('/projects/3/issues/33/add_spent_time', 'issue') | |
259 | @issue = Gitlab.add_time_spent_on_issue(3, 33, '-30m') | |
260 | end | |
261 | ||
262 | it 'gets the correct resource' do | |
263 | expect(a_post('/projects/3/issues/33/add_spent_time') | |
264 | .with(body: { duration: '-30m' })).to have_been_made | |
265 | end | |
266 | ||
267 | it 'returns information about the estimated issue' do | |
268 | expect(@issue.project_id).to eq(3) | |
269 | expect(@issue.assignee.name).to eq('Jack Smith') | |
270 | end | |
252 | 271 | end |
253 | 272 | end |
254 | 273 |
144 | 144 | expect(a_post('/projects/1/jobs/1/artifacts/keep')).to have_been_made |
145 | 145 | end |
146 | 146 | end |
147 | ||
148 | describe '.job_artifacts_delete' do | |
149 | before do | |
150 | stub_delete('/projects/1/jobs/1/artifacts', 'job') | |
151 | @projects = Gitlab.job_artifacts_delete(1, 1) | |
152 | end | |
153 | ||
154 | it 'gets the correct resource' do | |
155 | expect(a_delete('/projects/1/jobs/1/artifacts')).to have_been_made | |
156 | end | |
157 | end | |
147 | 158 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.validate_gitlab_ci_yml' do | |
6 | context 'when valid content' do | |
7 | before do | |
8 | stub_post('/lint', 'valid_content_gitlab_ci_yml') | |
9 | @lint_response = Gitlab.validate_gitlab_ci_yml('{ "image": "ruby:2.6", "services": ["postgres"], "before_script": ["bundle install", "bundle exec rake db:create"], "variables": {"DB_NAME": "postgres"}, "types": ["test", "deploy", "notify"], "rspec": { "script": "rake spec", "tags": ["ruby", "postgres"], "only": ["branches"]}}') | |
10 | end | |
11 | ||
12 | it 'gets the correct resource' do | |
13 | expect(a_post('/lint') | |
14 | .with(body: { content: '{ "image": "ruby:2.6", "services": ["postgres"], "before_script": ["bundle install", "bundle exec rake db:create"], "variables": {"DB_NAME": "postgres"}, "types": ["test", "deploy", "notify"], "rspec": { "script": "rake spec", "tags": ["ruby", "postgres"], "only": ["branches"]}}' })).to have_been_made | |
15 | end | |
16 | ||
17 | it 'returns correct information about validity of the response' do | |
18 | expect(@lint_response.status).to eq('valid') | |
19 | expect(@lint_response.errors).to eq([]) | |
20 | end | |
21 | end | |
22 | ||
23 | context 'when invalid content' do | |
24 | before do | |
25 | stub_post('/lint', 'invalid_content_gitlab_ci_yml') | |
26 | @lint_response = Gitlab.validate_gitlab_ci_yml('Not a valid content') | |
27 | end | |
28 | ||
29 | it 'gets the correct resource' do | |
30 | expect(a_post('/lint') | |
31 | .with(body: { content: 'Not a valid content' })).to have_been_made | |
32 | end | |
33 | ||
34 | it 'returns correct information about validity of the response' do | |
35 | expect(@lint_response.status).to eq('invalid') | |
36 | expect(@lint_response.errors).to include('variables config should be a hash of key value pairs') | |
37 | end | |
38 | end | |
39 | ||
40 | context 'when without content attribute' do | |
41 | before do | |
42 | stub_post('/lint', 'no_content_gitlab_ci_yml') | |
43 | @lint_response = Gitlab.validate_gitlab_ci_yml(nil) | |
44 | end | |
45 | ||
46 | it 'gets the correct resource' do | |
47 | expect(a_post('/lint')).to have_been_made | |
48 | end | |
49 | ||
50 | it 'returns correct information about validity of the response' do | |
51 | expect(@lint_response.error).to eq('content is missing') | |
52 | end | |
53 | end | |
54 | end | |
55 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.markdown' do | |
6 | before do | |
7 | stub_post('/markdown', 'markdown') | |
8 | Gitlab.markdown('Hello world! :tada:', gfm: true, project: 'group_example/project_example') | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_post('/markdown') | |
13 | .with(body: { text: 'Hello world! :tada:', gfm: true, project: 'group_example/project_example' })).to have_been_made | |
14 | end | |
15 | end | |
16 | end |
41 | 41 | describe '.edit_project_approvers' do |
42 | 42 | before do |
43 | 43 | body = { "approver_ids": ['5'], "approver_group_ids": ['1'] } |
44 | stub_put('/projects/1/approvals', 'project_merge_request_approvals').with(body: body) | |
44 | stub_put('/projects/1/approvers', 'project_merge_request_approvals').with(body: body) | |
45 | 45 | @project_mr_approvals = Gitlab.edit_project_approvers(1, approver_ids: [5], approver_group_ids: [1]) |
46 | 46 | end |
47 | 47 | |
48 | 48 | it 'gets the correct resource' do |
49 | 49 | body = { "approver_ids": ['5'], "approver_group_ids": ['1'] } |
50 | expect(a_put('/projects/1/approvals') | |
50 | expect(a_put('/projects/1/approvers') | |
51 | 51 | .with(body: body)).to have_been_made |
52 | 52 | end |
53 | 53 | |
96 | 96 | describe '.edit_merge_request_approvers' do |
97 | 97 | before do |
98 | 98 | body = { "approver_ids": ['1'], "approver_group_ids": ['5'] } |
99 | stub_put('/projects/1/merge_requests/5/approvals', 'merge_request_approvals').with(body: body) | |
99 | stub_put('/projects/1/merge_requests/5/approvers', 'merge_request_approvals').with(body: body) | |
100 | 100 | @merge_request_approvals = Gitlab.edit_merge_request_approvers(1, 5, approver_ids: [1], approver_group_ids: [5]) |
101 | 101 | end |
102 | 102 | |
103 | 103 | it 'gets the correct resource' do |
104 | 104 | body = { "approver_ids": ['1'], "approver_group_ids": ['5'] } |
105 | expect(a_put('/projects/1/merge_requests/5/approvals') | |
105 | expect(a_put('/projects/1/merge_requests/5/approvers') | |
106 | 106 | .with(body: body)).to have_been_made |
107 | 107 | end |
108 | 108 |
46 | 46 | it 'returns information about a merge request' do |
47 | 47 | expect(@merge_request.project_id).to eq(3) |
48 | 48 | expect(@merge_request.assignee.name).to eq('Jack Smith') |
49 | end | |
50 | end | |
51 | ||
52 | describe '.merge_request_participants' do | |
53 | before do | |
54 | stub_get('/projects/3/merge_requests/1/participants', 'participants') | |
55 | Gitlab.merge_request_participants(3, 1) | |
56 | end | |
57 | ||
58 | it 'gets the correct resource' do | |
59 | expect(a_get('/projects/3/merge_requests/1/participants')).to have_been_made | |
49 | 60 | end |
50 | 61 | end |
51 | 62 |
108 | 108 | Gitlab.private_token = nil |
109 | 109 | end |
110 | 110 | |
111 | after do | |
112 | Gitlab.private_token = 'secret' | |
113 | end | |
114 | ||
111 | 115 | it 'does not raise Error::MissingCredentials' do |
112 | 116 | expect { Gitlab.run_trigger(3, '7b9148c158980bbd9bcea92c17522d', 'master', a: 10) }.not_to raise_error |
113 | end | |
114 | ||
115 | after do | |
116 | Gitlab.private_token = 'secret' | |
117 | 117 | end |
118 | 118 | end |
119 | 119 |
108 | 108 | expect(@pipeline_retry.user.name).to eq('Administrator') |
109 | 109 | end |
110 | 110 | end |
111 | ||
112 | describe '.delete_pipeline' do | |
113 | before do | |
114 | stub_delete('/projects/3/pipelines/46', 'empty') | |
115 | Gitlab.delete_pipeline(3, 46) | |
116 | end | |
117 | ||
118 | it 'gets the correct resource' do | |
119 | expect(a_delete('/projects/3/pipelines/46')).to have_been_made | |
120 | end | |
121 | end | |
111 | 122 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.project_clusters' do | |
6 | before do | |
7 | stub_get('/projects/3/clusters', 'project_clusters') | |
8 | @project_clusters = Gitlab.project_clusters(3) | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/projects/3/clusters')).to have_been_made | |
13 | end | |
14 | ||
15 | it "returns a paginated response of project's clusters" do | |
16 | expect(@project_clusters).to be_a Gitlab::PaginatedResponse | |
17 | end | |
18 | end | |
19 | ||
20 | describe '.project_cluster' do | |
21 | before do | |
22 | stub_get('/projects/3/clusters/18', 'project_cluster') | |
23 | @project_cluster = Gitlab.project_cluster(3, 18) | |
24 | end | |
25 | ||
26 | it 'gets the correct resource' do | |
27 | expect(a_get('/projects/3/clusters/18')).to have_been_made | |
28 | end | |
29 | ||
30 | it 'returns information about a cluster' do | |
31 | expect(@project_cluster.id).to eq(18) | |
32 | end | |
33 | end | |
34 | ||
35 | describe '.add_project_cluster' do | |
36 | before do | |
37 | stub_post('/projects/3/clusters/user', 'project_cluster') | |
38 | @project_cluster = Gitlab.add_project_cluster(3, 'cluster-1', enabled: false, platform_kubernetes_attributes: { api_url: 'https://104.197.68.152', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-1-namespace', authorization_type: 'rbac' }) | |
39 | end | |
40 | ||
41 | it 'gets the correct resource' do | |
42 | expect(a_post('/projects/3/clusters/user') | |
43 | .with(body: { name: 'cluster-1' }.merge(enabled: false, platform_kubernetes_attributes: { api_url: 'https://104.197.68.152', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-1-namespace', authorization_type: 'rbac' }))).to have_been_made | |
44 | end | |
45 | ||
46 | it 'returns information about an added project cluster' do | |
47 | expect(@project_cluster.name).to eq('cluster-1') | |
48 | expect(@project_cluster.platform_kubernetes.api_url).to eq('https://104.197.68.152') | |
49 | expect(@project_cluster.platform_kubernetes.namespace).to eq('cluster-1-namespace') | |
50 | expect(@project_cluster.platform_kubernetes.authorization_type).to eq('rbac') | |
51 | expect(@project_cluster.platform_kubernetes.ca_cert).to eq("-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----") | |
52 | end | |
53 | end | |
54 | ||
55 | describe '.edit_project_cluster' do | |
56 | before do | |
57 | stub_put('/projects/3/clusters/18', 'project_cluster') | |
58 | @project_cluster = Gitlab.edit_project_cluster(3, 18, name: 'cluster-1', platform_kubernetes_attributes: { api_url: 'https://104.197.68.152' }) | |
59 | end | |
60 | ||
61 | it 'gets the correct resource' do | |
62 | expect(a_put('/projects/3/clusters/18') | |
63 | .with(body: { name: 'cluster-1', platform_kubernetes_attributes: { api_url: 'https://104.197.68.152' } })).to have_been_made | |
64 | end | |
65 | ||
66 | it 'returns information about an edited project cluster' do | |
67 | expect(@project_cluster.name).to eq('cluster-1') | |
68 | expect(@project_cluster.platform_kubernetes.api_url).to eq('https://104.197.68.152') | |
69 | end | |
70 | end | |
71 | ||
72 | describe '.delete_project_cluster' do | |
73 | before do | |
74 | stub_delete('/projects/3/clusters/18', 'empty') | |
75 | Gitlab.delete_project_cluster(3, 18) | |
76 | end | |
77 | ||
78 | it 'gets the correct resource' do | |
79 | expect(a_delete('/projects/3/clusters/18')).to have_been_made | |
80 | end | |
81 | end | |
82 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.project_release_links' do | |
6 | before do | |
7 | stub_get('/projects/3/releases/v0.1/assets/links', 'project_release_links') | |
8 | @project_release_links = Gitlab.project_release_links(3, 'v0.1') | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/projects/3/releases/v0.1/assets/links')).to have_been_made | |
13 | end | |
14 | ||
15 | it "returns a paginated response of project's release links" do | |
16 | expect(@project_release_links).to be_a Gitlab::PaginatedResponse | |
17 | end | |
18 | end | |
19 | ||
20 | describe '.project_release_link' do | |
21 | before do | |
22 | stub_get('/projects/3/releases/v0.1/assets/links/1', 'project_release_link') | |
23 | @project_release_link = Gitlab.project_release_link(3, 'v0.1', 1) | |
24 | end | |
25 | ||
26 | it 'gets the correct resource' do | |
27 | expect(a_get('/projects/3/releases/v0.1/assets/links/1')).to have_been_made | |
28 | end | |
29 | ||
30 | it "returns information about a project's release link" do | |
31 | expect(@project_release_link.id).to eq(1) | |
32 | end | |
33 | end | |
34 | ||
35 | describe '.create_project_release_link' do | |
36 | before do | |
37 | stub_post('/projects/5/releases/v0.1/assets/links', 'project_release_link') | |
38 | @project_release_link = Gitlab.create_project_release_link(5, 'v0.1', name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000') | |
39 | end | |
40 | ||
41 | it 'gets the correct resource' do | |
42 | expect(a_post('/projects/5/releases/v0.1/assets/links') | |
43 | .with(body: { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' })).to have_been_made | |
44 | end | |
45 | ||
46 | it 'returns information about the created release link' do | |
47 | expect(@project_release_link.name).to eq('awesome-v0.2.dmg') | |
48 | expect(@project_release_link.url).to eq('http://192.168.10.15:3000') | |
49 | end | |
50 | end | |
51 | ||
52 | describe '.update_project_release_link' do | |
53 | before do | |
54 | stub_put('/projects/5/releases/v0.1/assets/links/1', 'project_release_link') | |
55 | @project_release_link = Gitlab.update_project_release_link(5, 'v0.1', 1, url: 'http://192.168.10.15:3000') | |
56 | end | |
57 | ||
58 | it 'gets the correct resource' do | |
59 | expect(a_put('/projects/5/releases/v0.1/assets/links/1') | |
60 | .with(body: { url: 'http://192.168.10.15:3000' })).to have_been_made | |
61 | end | |
62 | ||
63 | it 'returns information about an updated project release link' do | |
64 | expect(@project_release_link.url).to eq('http://192.168.10.15:3000') | |
65 | end | |
66 | end | |
67 | ||
68 | describe '.delete_project_release_link' do | |
69 | before do | |
70 | stub_delete('/projects/3/releases/v0.1/assets/links/1', 'project_release_link') | |
71 | @project_release_link = Gitlab.delete_project_release_link(3, 'v0.1', 1) | |
72 | end | |
73 | ||
74 | it 'gets the correct resource' do | |
75 | expect(a_delete('/projects/3/releases/v0.1/assets/links/1')).to have_been_made | |
76 | end | |
77 | ||
78 | it 'returns information about the deleted project release link' do | |
79 | expect(@project_release_link.id).to eq(1) | |
80 | end | |
81 | end | |
82 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.project_releases' do | |
6 | before do | |
7 | stub_get('/projects/3/releases', 'project_releases') | |
8 | @project_releases = Gitlab.project_releases(3) | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/projects/3/releases')).to have_been_made | |
13 | end | |
14 | ||
15 | it "returns a paginated response of project's releases" do | |
16 | expect(@project_releases).to be_a Gitlab::PaginatedResponse | |
17 | end | |
18 | end | |
19 | ||
20 | describe '.project_release' do | |
21 | before do | |
22 | stub_get('/projects/3/releases/v0.1', 'project_release') | |
23 | @project_release = Gitlab.project_release(3, 'v0.1') | |
24 | end | |
25 | ||
26 | it 'gets the correct resource' do | |
27 | expect(a_get('/projects/3/releases/v0.1')).to have_been_made | |
28 | end | |
29 | ||
30 | it 'returns information about a release' do | |
31 | expect(@project_release.tag_name).to eq('v0.1') | |
32 | end | |
33 | end | |
34 | ||
35 | describe '.create_project_release' do | |
36 | context 'without asset links' do | |
37 | before do | |
38 | stub_post('/projects/5/releases', 'project_release') | |
39 | @project_release = Gitlab.create_project_release(5, name: 'Awesome app v0.1 alpha', tag_name: 'v0.1', description: "## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516") | |
40 | end | |
41 | ||
42 | it 'gets the correct resource' do | |
43 | expect(a_post('/projects/5/releases') | |
44 | .with(body: { name: 'Awesome app v0.1 alpha', tag_name: 'v0.1', description: "## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516" })).to have_been_made | |
45 | end | |
46 | ||
47 | it 'returns information about the created release' do | |
48 | expect(@project_release.name).to eq('Awesome app v0.1 alpha') | |
49 | expect(@project_release.tag_name).to eq('v0.1') | |
50 | expect(@project_release.description).to eq("## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516") | |
51 | end | |
52 | end | |
53 | ||
54 | context 'with asset links' do | |
55 | before do | |
56 | stub_post('/projects/5/releases', 'project_release_with_assets') | |
57 | @project_release = Gitlab.create_project_release(5, name: 'Awesome app v0.1 alpha', tag_name: 'v0.1', description: "## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516", assets: { links: [{ name: 'awesome-v0.2.msi', url: 'http://192.168.10.15:3000/msi' }, { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' }] }) | |
58 | end | |
59 | ||
60 | it 'gets the correct resource' do | |
61 | expect(a_post('/projects/5/releases') | |
62 | .with(body: { name: 'Awesome app v0.1 alpha', tag_name: 'v0.1', description: "## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516", assets: { links: [{ name: 'awesome-v0.2.msi', url: 'http://192.168.10.15:3000/msi' }, { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' }] } })).to have_been_made | |
63 | end | |
64 | ||
65 | it 'returns information about the created release' do | |
66 | expect(@project_release.name).to eq('Awesome app v0.1 alpha') | |
67 | expect(@project_release.tag_name).to eq('v0.1') | |
68 | expect(@project_release.description).to eq("## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516") | |
69 | expect(@project_release.assets.links[0]['name']).to eq('awesome-v0.2.msi') | |
70 | expect(@project_release.assets.links[0]['url']).to eq('http://192.168.10.15:3000/msi') | |
71 | expect(@project_release.assets.links[1]['name']).to eq('awesome-v0.2.dmg') | |
72 | expect(@project_release.assets.links[1]['url']).to eq('http://192.168.10.15:3000') | |
73 | end | |
74 | end | |
75 | end | |
76 | ||
77 | describe '.update_project_release' do | |
78 | before do | |
79 | stub_put('/projects/5/releases/v0.1', 'project_release') | |
80 | @project_release = Gitlab.update_project_release(5, 'v0.1', name: 'Awesome app v0.1 alpha') | |
81 | end | |
82 | ||
83 | it 'gets the correct resource' do | |
84 | expect(a_put('/projects/5/releases/v0.1') | |
85 | .with(body: { name: 'Awesome app v0.1 alpha' })).to have_been_made | |
86 | end | |
87 | ||
88 | it 'returns information about an updated project release' do | |
89 | expect(@project_release.name).to eq('Awesome app v0.1 alpha') | |
90 | end | |
91 | end | |
92 | ||
93 | describe '.delete_project_release' do | |
94 | before do | |
95 | stub_delete('/projects/3/releases/v0.1', 'project_release') | |
96 | @project_release = Gitlab.delete_project_release(3, 'v0.1') | |
97 | end | |
98 | ||
99 | it 'gets the correct resource' do | |
100 | expect(a_delete('/projects/3/releases/v0.1')).to have_been_made | |
101 | end | |
102 | ||
103 | it 'returns information about the deleted project release' do | |
104 | expect(@project_release.tag_name).to eq('v0.1') | |
105 | end | |
106 | end | |
107 | end |
73 | 73 | describe '.create_project for user' do |
74 | 74 | before do |
75 | 75 | stub_post('/users', 'user') |
76 | @owner = Gitlab.create_user('john@example.com', 'pass', name: 'John Owner') | |
76 | @owner = Gitlab.create_user('john@example.com', 'pass', 'john', name: 'John Owner') | |
77 | 77 | stub_post("/projects/user/#{@owner.id}", 'project_for_user') |
78 | 78 | @project = Gitlab.create_project('Brute', user_id: @owner.id) |
79 | 79 | end |
599 | 599 | end |
600 | 600 | end |
601 | 601 | |
602 | describe '.edit_deploy_key' do | |
603 | context 'no options' do | |
604 | before do | |
605 | body = { title: 'New key name' } | |
606 | stub_put('/projects/42/deploy_keys/2', 'project_key_edit').with(body: body) | |
607 | @project_deploy_key = Gitlab.edit_deploy_key(42, 2, 'New key name') | |
608 | end | |
609 | ||
610 | it 'puts the correct resource' do | |
611 | body = { title: 'New key name' } | |
612 | expect(a_put('/projects/42/deploy_keys/2') | |
613 | .with(body: body)).to have_been_made | |
614 | end | |
615 | ||
616 | it 'returns the correct updated information' do | |
617 | expect(@project_deploy_key).to be_a Gitlab::ObjectifiedHash | |
618 | expect(@project_deploy_key.title).to eq 'New key name' | |
619 | end | |
620 | end | |
621 | ||
622 | context 'some options' do | |
623 | before do | |
624 | body = { title: 'New key name', can_push: true } | |
625 | stub_put('/projects/42/deploy_keys/2', 'project_key_edit').with(body: body) | |
626 | @project_deploy_key = Gitlab.edit_deploy_key(42, 2, 'New key name', can_push: true) | |
627 | end | |
628 | ||
629 | it 'puts the correct resource' do | |
630 | body = { title: 'New key name', can_push: true } | |
631 | expect(a_put('/projects/42/deploy_keys/2') | |
632 | .with(body: body)).to have_been_made | |
633 | end | |
634 | ||
635 | it 'returns the correct updated information' do | |
636 | expect(@project_deploy_key).to be_a Gitlab::ObjectifiedHash | |
637 | expect(@project_deploy_key.title).to eq 'New key name' | |
638 | expect(@project_deploy_key.can_push).to eq true | |
639 | end | |
640 | end | |
641 | end | |
642 | ||
602 | 643 | describe '.share_project_with_group' do |
603 | 644 | before do |
604 | 645 | stub_post('/projects/3/share', 'group') |
694 | 735 | |
695 | 736 | describe '.upload_file' do |
696 | 737 | let(:id) { 1 } |
697 | let(:file) { File.open(File::NULL, 'r') } | |
738 | let(:file_fullpath) { File::NULL } | |
698 | 739 | |
699 | 740 | before do |
700 | 741 | stub_post("/projects/#{id}/uploads", 'upload_file') |
701 | @file = Gitlab.upload_file(id, file) | |
742 | @file = Gitlab.upload_file(id, file_fullpath) | |
702 | 743 | end |
703 | 744 | |
704 | 745 | it 'gets the correct resource' do |
750 | 791 | end |
751 | 792 | end |
752 | 793 | end |
794 | ||
795 | describe '.archive_project' do | |
796 | before do | |
797 | stub_post('/projects/3/archive', 'project_archive') | |
798 | @archived_project = Gitlab.archive_project('3') | |
799 | end | |
800 | ||
801 | it 'gets the correct resource' do | |
802 | expect(a_post('/projects/3/archive')).to have_been_made | |
803 | end | |
804 | ||
805 | it 'returns information about a archived project' do | |
806 | expect(@archived_project.name).to eq('GitLab Community Edition') | |
807 | expect(@archived_project.archived).to eq(true) | |
808 | end | |
809 | end | |
810 | ||
811 | describe '.unarchive_project' do | |
812 | before do | |
813 | stub_post('/projects/3/unarchive', 'project_unarchive') | |
814 | @unarchived_project = Gitlab.unarchive_project('3') | |
815 | end | |
816 | ||
817 | it 'gets the correct resource' do | |
818 | expect(a_post('/projects/3/unarchive')).to have_been_made | |
819 | end | |
820 | ||
821 | it 'returns information about a unarchived project' do | |
822 | expect(@unarchived_project.name).to eq('GitLab Community Edition') | |
823 | expect(@unarchived_project.archived).to eq(false) | |
824 | end | |
825 | end | |
753 | 826 | end |
8 | 8 | it { is_expected.to respond_to :repo_branch } |
9 | 9 | it { is_expected.to respond_to :repo_tree } |
10 | 10 | it { is_expected.to respond_to :repo_compare } |
11 | it { is_expected.to respond_to :repo_contributors } | |
11 | 12 | |
12 | 13 | describe '.tags' do |
13 | 14 | before do |
111 | 112 | end |
112 | 113 | end |
113 | 114 | end |
115 | ||
116 | describe '.contributors' do | |
117 | before do | |
118 | stub_get('/projects/3/repository/contributors', 'contributors') | |
119 | @contributors = Gitlab.contributors(3) | |
120 | end | |
121 | ||
122 | it 'gets the correct resource' do | |
123 | expect(a_get('/projects/3/repository/contributors')).to have_been_made | |
124 | end | |
125 | ||
126 | it 'returns a paginated response of repository contributors' do | |
127 | expect(@contributors).to be_a Gitlab::PaginatedResponse | |
128 | expect(@contributors.first.name).to eq('Dmitriy Zaporozhets') | |
129 | expect(@contributors.first.commits).to eq(117) | |
130 | end | |
131 | end |
14 | 14 | |
15 | 15 | it 'returns file contents' do |
16 | 16 | expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n") |
17 | end | |
18 | end | |
19 | ||
20 | describe '.get_file_blame' do | |
21 | before do | |
22 | stub_get('/projects/3/repository/files/README%2Emd/blame?ref=master', 'get_file_blame') | |
23 | @blames = Gitlab.get_file_blame(3, 'README.md', 'master') | |
24 | end | |
25 | ||
26 | it 'gets the correct resource' do | |
27 | expect(a_get('/projects/3/repository/files/README%2Emd/blame?ref=master')).to have_been_made | |
28 | end | |
29 | ||
30 | it 'returns the blame info of the file' do | |
31 | expect(@blames.first.commit.id).to eq('d42409d56517157c48bf3bd97d3f75974dde19fb') | |
17 | 32 | end |
18 | 33 | end |
19 | 34 |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.issue_label_events' do | |
6 | before do | |
7 | stub_get('/projects/5/issues/42/resource_label_events', 'resource_label_events') | |
8 | @events = Gitlab.issue_label_events(5, 42) | |
9 | end | |
10 | ||
11 | it 'gets the correct resource' do | |
12 | expect(a_get('/projects/5/issues/42/resource_label_events')).to have_been_made | |
13 | end | |
14 | ||
15 | it "returns a paginated response of project's issue's label events" do | |
16 | expect(@events).to be_a Gitlab::PaginatedResponse | |
17 | expect(@events.first.id).to eq(142) | |
18 | end | |
19 | end | |
20 | ||
21 | describe '.issue_label_event' do | |
22 | before do | |
23 | stub_get('/projects/5/issues/42/resource_label_events/142', 'resource_label_event') | |
24 | @event = Gitlab.issue_label_event(5, 42, 142) | |
25 | end | |
26 | ||
27 | it 'gets the correct resource' do | |
28 | expect(a_get('/projects/5/issues/42/resource_label_events/142')).to have_been_made | |
29 | end | |
30 | ||
31 | it "returns a paginated response of project's issue's label event" do | |
32 | expect(@event).to be_a Gitlab::ObjectifiedHash | |
33 | expect(@event.user.name).to eq('Administrator') | |
34 | end | |
35 | end | |
36 | ||
37 | describe '.epic_label_events' do | |
38 | before do | |
39 | stub_get('/groups/5/epics/42/resource_label_events', 'resource_label_events') | |
40 | @events = Gitlab.epic_label_events(5, 42) | |
41 | end | |
42 | ||
43 | it 'gets the correct resource' do | |
44 | expect(a_get('/groups/5/epics/42/resource_label_events')).to have_been_made | |
45 | end | |
46 | ||
47 | it "returns a paginated response of project's epic's label events" do | |
48 | expect(@events).to be_a Gitlab::PaginatedResponse | |
49 | expect(@events.first.id).to eq(142) | |
50 | end | |
51 | end | |
52 | ||
53 | describe '.epic_label_event' do | |
54 | before do | |
55 | stub_get('/groups/5/epics/42/resource_label_events/142', 'resource_label_event') | |
56 | @event = Gitlab.epic_label_event(5, 42, 142) | |
57 | end | |
58 | ||
59 | it 'gets the correct resource' do | |
60 | expect(a_get('/groups/5/epics/42/resource_label_events/142')).to have_been_made | |
61 | end | |
62 | ||
63 | it "returns a paginated response of project's epic's label event" do | |
64 | expect(@event).to be_a Gitlab::ObjectifiedHash | |
65 | expect(@event.user.name).to eq('Administrator') | |
66 | end | |
67 | end | |
68 | ||
69 | describe '.merge_request_label_events' do | |
70 | before do | |
71 | stub_get('/projects/5/merge_requests/42/resource_label_events', 'resource_label_events') | |
72 | @events = Gitlab.merge_request_label_events(5, 42) | |
73 | end | |
74 | ||
75 | it 'gets the correct resource' do | |
76 | expect(a_get('/projects/5/merge_requests/42/resource_label_events')).to have_been_made | |
77 | end | |
78 | ||
79 | it "returns a paginated response of project's merge request's label events" do | |
80 | expect(@events).to be_a Gitlab::PaginatedResponse | |
81 | expect(@events.first.id).to eq(142) | |
82 | end | |
83 | end | |
84 | ||
85 | describe '.merge_request_label_event' do | |
86 | before do | |
87 | stub_get('/projects/5/merge_requests/42/resource_label_events/142', 'resource_label_event') | |
88 | @event = Gitlab.merge_request_label_event(5, 42, 142) | |
89 | end | |
90 | ||
91 | it 'gets the correct resource' do | |
92 | expect(a_get('/projects/5/merge_requests/42/resource_label_events/142')).to have_been_made | |
93 | end | |
94 | ||
95 | it "returns a paginated response of project's merge request's label event" do | |
96 | expect(@event).to be_a Gitlab::ObjectifiedHash | |
97 | expect(@event.user.name).to eq('Administrator') | |
98 | end | |
99 | end | |
100 | end |
131 | 131 | |
132 | 132 | describe '.runner_jobs' do |
133 | 133 | before do |
134 | stub_get('/runners/1/jobs', 'runner_jobs') | |
135 | @jobs = Gitlab.runner_jobs(1) | |
136 | end | |
137 | ||
138 | it 'gets the correct resource' do | |
139 | expect(a_get('/runners/1/jobs')).to have_been_made | |
134 | stub_get('/runners/1/jobs?status=running', 'runner_jobs') | |
135 | @jobs = Gitlab.runner_jobs(1, status: :running) | |
136 | end | |
137 | ||
138 | it 'gets the correct resource' do | |
139 | expect(a_get('/runners/1/jobs').with(query: { status: :running })).to have_been_made | |
140 | 140 | end |
141 | 141 | end |
142 | 142 | |
190 | 190 | expect(@runner.description).to eq('test-1-20150125') |
191 | 191 | end |
192 | 192 | end |
193 | ||
194 | describe '.register_runner' do | |
195 | before do | |
196 | stub_post('/runners', 'register_runner_response').with(body: { token: '6337ff461c94fd3fa32ba3b1ff4125', description: 'Some Description', active: true, locked: false }) | |
197 | @register_runner_response = Gitlab.register_runner('6337ff461c94fd3fa32ba3b1ff4125', description: 'Some Description', active: true, locked: false) | |
198 | end | |
199 | ||
200 | it 'gets the correct resource' do | |
201 | expect(a_post('/runners') | |
202 | .with(body: { token: '6337ff461c94fd3fa32ba3b1ff4125', description: 'Some Description', active: true, locked: false })).to have_been_made | |
203 | end | |
204 | ||
205 | it 'returns correct response for the runner registration' do | |
206 | expect(@register_runner_response.token).to eq('6337ff461c94fd3fa32ba3b1ff4125') | |
207 | end | |
208 | end | |
209 | ||
210 | describe '.delete_registered_runner' do | |
211 | before do | |
212 | stub_delete('/runners', 'empty').with(body: { token: '6337ff461c94fd3fa32ba3b1ff4125' }) | |
213 | Gitlab.delete_registered_runner('6337ff461c94fd3fa32ba3b1ff4125') | |
214 | end | |
215 | ||
216 | it 'gets the correct resource' do | |
217 | expect(a_delete('/runners') | |
218 | .with(body: { token: '6337ff461c94fd3fa32ba3b1ff4125' })).to have_been_made | |
219 | end | |
220 | end | |
221 | ||
222 | describe '.verify_auth_registered_runner' do | |
223 | before do | |
224 | stub_post('/runners/verify', 'empty').with(body: { token: '6337ff461c94fd3fa32ba3b1ff4125' }) | |
225 | Gitlab.verify_auth_registered_runner('6337ff461c94fd3fa32ba3b1ff4125') | |
226 | end | |
227 | ||
228 | it 'gets the correct resource' do | |
229 | expect(a_post('/runners/verify') | |
230 | .with(body: { token: '6337ff461c94fd3fa32ba3b1ff4125' })).to have_been_made | |
231 | end | |
232 | end | |
193 | 233 | end |
0 | # frozen_string_literal: true | |
1 | ||
2 | require 'spec_helper' | |
3 | ||
4 | describe Gitlab::Client do | |
5 | describe '.search_globally' do | |
6 | context 'when scope projects' do | |
7 | before do | |
8 | stub_get('/search', 'search_projects_results').with(query: { scope: 'projects', search: 'flight' }) | |
9 | @search = Gitlab.search_globally('projects', 'flight') | |
10 | end | |
11 | ||
12 | it 'gets the correct resource' do | |
13 | expect(a_get('/search') | |
14 | .with(query: { scope: 'projects', search: 'flight' })).to have_been_made | |
15 | end | |
16 | ||
17 | it 'returns a paginated response of search results' do | |
18 | expect(@search).to be_a Gitlab::PaginatedResponse | |
19 | end | |
20 | end | |
21 | ||
22 | context 'when scope issues' do | |
23 | before do | |
24 | stub_get('/search', 'search_issues_results').with(query: { scope: 'issues', search: 'file' }) | |
25 | @search = Gitlab.search_globally('issues', 'file') | |
26 | end | |
27 | ||
28 | it 'gets the correct resource' do | |
29 | expect(a_get('/search') | |
30 | .with(query: { scope: 'issues', search: 'file' })).to have_been_made | |
31 | end | |
32 | ||
33 | it 'returns a paginated response of search results' do | |
34 | expect(@search).to be_a Gitlab::PaginatedResponse | |
35 | end | |
36 | end | |
37 | ||
38 | context 'when scope merge_requests' do | |
39 | before do | |
40 | stub_get('/search', 'search_merge_requests_results').with(query: { scope: 'merge_requests', search: 'file' }) | |
41 | @search = Gitlab.search_globally('merge_requests', 'file') | |
42 | end | |
43 | ||
44 | it 'gets the correct resource' do | |
45 | expect(a_get('/search') | |
46 | .with(query: { scope: 'merge_requests', search: 'file' })).to have_been_made | |
47 | end | |
48 | ||
49 | it 'returns a paginated response of search results' do | |
50 | expect(@search).to be_a Gitlab::PaginatedResponse | |
51 | end | |
52 | end | |
53 | ||
54 | context 'when scope milestones' do | |
55 | before do | |
56 | stub_get('/search', 'search_milestones_results').with(query: { scope: 'milestones', search: 'release' }) | |
57 | @search = Gitlab.search_globally('milestones', 'release') | |
58 | end | |
59 | ||
60 | it 'gets the correct resource' do | |
61 | expect(a_get('/search') | |
62 | .with(query: { scope: 'milestones', search: 'release' })).to have_been_made | |
63 | end | |
64 | ||
65 | it 'returns a paginated response of search results' do | |
66 | expect(@search).to be_a Gitlab::PaginatedResponse | |
67 | end | |
68 | end | |
69 | ||
70 | context 'when scope snippet_titles' do | |
71 | before do | |
72 | stub_get('/search', 'search_snippet_titles_results').with(query: { scope: 'snippet_titles', search: 'sample' }) | |
73 | @search = Gitlab.search_globally('snippet_titles', 'sample') | |
74 | end | |
75 | ||
76 | it 'gets the correct resource' do | |
77 | expect(a_get('/search') | |
78 | .with(query: { scope: 'snippet_titles', search: 'sample' })).to have_been_made | |
79 | end | |
80 | ||
81 | it 'returns a paginated response of search results' do | |
82 | expect(@search).to be_a Gitlab::PaginatedResponse | |
83 | end | |
84 | end | |
85 | ||
86 | context 'when scope snippet_blobs' do | |
87 | before do | |
88 | stub_get('/search', 'search_snippet_blobs_results').with(query: { scope: 'snippet_blobs', search: 'test' }) | |
89 | @search = Gitlab.search_globally('snippet_blobs', 'test') | |
90 | end | |
91 | ||
92 | it 'gets the correct resource' do | |
93 | expect(a_get('/search') | |
94 | .with(query: { scope: 'snippet_blobs', search: 'test' })).to have_been_made | |
95 | end | |
96 | ||
97 | it 'returns a paginated response of search results' do | |
98 | expect(@search).to be_a Gitlab::PaginatedResponse | |
99 | end | |
100 | end | |
101 | end | |
102 | ||
103 | describe '.search_in_group' do | |
104 | context 'when scope projects' do | |
105 | before do | |
106 | stub_get('/groups/3/search', 'search_projects_results').with(query: { scope: 'projects', search: 'flight' }) | |
107 | @search = Gitlab.search_in_group(3, 'projects', 'flight') | |
108 | end | |
109 | ||
110 | it 'gets the correct resource' do | |
111 | expect(a_get('/groups/3/search') | |
112 | .with(query: { scope: 'projects', search: 'flight' })).to have_been_made | |
113 | end | |
114 | ||
115 | it 'returns a paginated response of search results' do | |
116 | expect(@search).to be_a Gitlab::PaginatedResponse | |
117 | end | |
118 | end | |
119 | ||
120 | context 'when scope issues' do | |
121 | before do | |
122 | stub_get('/groups/3/search', 'search_issues_results').with(query: { scope: 'issues', search: 'file' }) | |
123 | @search = Gitlab.search_in_group(3, 'issues', 'file') | |
124 | end | |
125 | ||
126 | it 'gets the correct resource' do | |
127 | expect(a_get('/groups/3/search') | |
128 | .with(query: { scope: 'issues', search: 'file' })).to have_been_made | |
129 | end | |
130 | ||
131 | it 'returns a paginated response of search results' do | |
132 | expect(@search).to be_a Gitlab::PaginatedResponse | |
133 | end | |
134 | end | |
135 | ||
136 | context 'when scope merge_requests' do | |
137 | before do | |
138 | stub_get('/groups/3/search', 'search_merge_requests_results').with(query: { scope: 'merge_requests', search: 'file' }) | |
139 | @search = Gitlab.search_in_group(3, 'merge_requests', 'file') | |
140 | end | |
141 | ||
142 | it 'gets the correct resource' do | |
143 | expect(a_get('/groups/3/search') | |
144 | .with(query: { scope: 'merge_requests', search: 'file' })).to have_been_made | |
145 | end | |
146 | ||
147 | it 'returns a paginated response of search results' do | |
148 | expect(@search).to be_a Gitlab::PaginatedResponse | |
149 | end | |
150 | end | |
151 | ||
152 | context 'when scope milestones' do | |
153 | before do | |
154 | stub_get('/groups/3/search', 'search_milestones_results').with(query: { scope: 'milestones', search: 'release' }) | |
155 | @search = Gitlab.search_in_group(3, 'milestones', 'release') | |
156 | end | |
157 | ||
158 | it 'gets the correct resource' do | |
159 | expect(a_get('/groups/3/search') | |
160 | .with(query: { scope: 'milestones', search: 'release' })).to have_been_made | |
161 | end | |
162 | ||
163 | it 'returns a paginated response of search results' do | |
164 | expect(@search).to be_a Gitlab::PaginatedResponse | |
165 | end | |
166 | end | |
167 | end | |
168 | ||
169 | describe '.search_in_project' do | |
170 | context 'when scope issues' do | |
171 | before do | |
172 | stub_get('/projects/12/search', 'search_issues_results').with(query: { scope: 'issues', search: 'file' }) | |
173 | @search = Gitlab.search_in_project(12, 'issues', 'file') | |
174 | end | |
175 | ||
176 | it 'gets the correct resource' do | |
177 | expect(a_get('/projects/12/search') | |
178 | .with(query: { scope: 'issues', search: 'file' })).to have_been_made | |
179 | end | |
180 | ||
181 | it 'returns a paginated response of search results' do | |
182 | expect(@search).to be_a Gitlab::PaginatedResponse | |
183 | expect(@search[0].project_id).to eq(12) | |
184 | end | |
185 | end | |
186 | ||
187 | context 'when scope merge_requests' do | |
188 | before do | |
189 | stub_get('/projects/6/search', 'search_merge_requests_results').with(query: { scope: 'merge_requests', search: 'file' }) | |
190 | @search = Gitlab.search_in_project(6, 'merge_requests', 'file') | |
191 | end | |
192 | ||
193 | it 'gets the correct resource' do | |
194 | expect(a_get('/projects/6/search') | |
195 | .with(query: { scope: 'merge_requests', search: 'file' })).to have_been_made | |
196 | end | |
197 | ||
198 | it 'returns a paginated response of search results' do | |
199 | expect(@search).to be_a Gitlab::PaginatedResponse | |
200 | expect(@search[0].project_id).to eq(6) | |
201 | end | |
202 | end | |
203 | ||
204 | context 'when scope milestones' do | |
205 | before do | |
206 | stub_get('/projects/12/search', 'search_milestones_results').with(query: { scope: 'milestones', search: 'release' }) | |
207 | @search = Gitlab.search_in_project(12, 'milestones', 'release') | |
208 | end | |
209 | ||
210 | it 'gets the correct resource' do | |
211 | expect(a_get('/projects/12/search') | |
212 | .with(query: { scope: 'milestones', search: 'release' })).to have_been_made | |
213 | end | |
214 | ||
215 | it 'returns a paginated response of search results' do | |
216 | expect(@search).to be_a Gitlab::PaginatedResponse | |
217 | expect(@search[0].project_id).to eq(12) | |
218 | end | |
219 | end | |
220 | ||
221 | context 'when scope notes' do | |
222 | before do | |
223 | stub_get('/projects/6/search', 'search_notes_results').with(query: { scope: 'notes', search: 'maxime' }) | |
224 | @search = Gitlab.search_in_project(6, 'notes', 'maxime') | |
225 | end | |
226 | ||
227 | it 'gets the correct resource' do | |
228 | expect(a_get('/projects/6/search') | |
229 | .with(query: { scope: 'notes', search: 'maxime' })).to have_been_made | |
230 | end | |
231 | ||
232 | it 'returns a paginated response of search results' do | |
233 | expect(@search).to be_a Gitlab::PaginatedResponse | |
234 | end | |
235 | end | |
236 | ||
237 | context 'when scope wiki_blobs' do | |
238 | before do | |
239 | stub_get('/projects/6/search', 'search_wiki_blobs_results').with(query: { scope: 'wiki_blobs', search: 'bye' }) | |
240 | @search = Gitlab.search_in_project(6, 'wiki_blobs', 'bye') | |
241 | end | |
242 | ||
243 | it 'gets the correct resource' do | |
244 | expect(a_get('/projects/6/search') | |
245 | .with(query: { scope: 'wiki_blobs', search: 'bye' })).to have_been_made | |
246 | end | |
247 | ||
248 | it 'returns a paginated response of search results' do | |
249 | expect(@search).to be_a Gitlab::PaginatedResponse | |
250 | expect(@search[0].project_id).to eq(6) | |
251 | end | |
252 | end | |
253 | ||
254 | context 'when scope commits' do | |
255 | before do | |
256 | stub_get('/projects/6/search', 'search_commits_results').with(query: { scope: 'commits', search: 'bye' }) | |
257 | @search = Gitlab.search_in_project(6, 'commits', 'bye') | |
258 | end | |
259 | ||
260 | it 'gets the correct resource' do | |
261 | expect(a_get('/projects/6/search') | |
262 | .with(query: { scope: 'commits', search: 'bye' })).to have_been_made | |
263 | end | |
264 | ||
265 | it 'returns a paginated response of search results' do | |
266 | expect(@search).to be_a Gitlab::PaginatedResponse | |
267 | expect(@search[0].project_id).to eq(6) | |
268 | end | |
269 | end | |
270 | ||
271 | context 'when scope blobs' do | |
272 | before do | |
273 | stub_get('/projects/6/search', 'search_blobs_results').with(query: { scope: 'blobs', search: 'installation' }) | |
274 | @search = Gitlab.search_in_project(6, 'blobs', 'installation') | |
275 | end | |
276 | ||
277 | it 'gets the correct resource' do | |
278 | expect(a_get('/projects/6/search') | |
279 | .with(query: { scope: 'blobs', search: 'installation' })).to have_been_made | |
280 | end | |
281 | ||
282 | it 'returns a paginated response of search results' do | |
283 | expect(@search).to be_a Gitlab::PaginatedResponse | |
284 | expect(@search[0].project_id).to eq(6) | |
285 | end | |
286 | end | |
287 | end | |
288 | end |
54 | 54 | context 'when successful request' do |
55 | 55 | before do |
56 | 56 | stub_post('/users', 'user') |
57 | @user = Gitlab.create_user('email', 'pass') | |
58 | end | |
59 | ||
60 | it 'gets the correct resource' do | |
61 | body = { email: 'email', password: 'pass', name: 'email' } | |
57 | @user = Gitlab.create_user('email', 'pass', 'john.smith') | |
58 | end | |
59 | ||
60 | it 'gets the correct resource' do | |
61 | body = { email: 'email', password: 'pass', username: 'john.smith', name: 'email' } | |
62 | 62 | expect(a_post('/users').with(body: body)).to have_been_made |
63 | 63 | end |
64 | 64 | |
71 | 71 | it 'throws an exception' do |
72 | 72 | stub_post('/users', 'error_already_exists', 409) |
73 | 73 | expect do |
74 | Gitlab.create_user('email', 'pass', 'john.smith') | |
75 | end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users") | |
76 | end | |
77 | end | |
78 | ||
79 | context 'when not enough arguments' do | |
80 | it 'throws an exception' do | |
81 | expect do | |
74 | 82 | Gitlab.create_user('email', 'pass') |
75 | end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users") | |
83 | end.to raise_error(ArgumentError, 'Missing required parameters') | |
76 | 84 | end |
77 | 85 | end |
78 | 86 | end |
85 | 93 | end |
86 | 94 | |
87 | 95 | it 'gets the correct resource' do |
88 | body = { email: 'email', password: 'pass', username: 'username' } | |
96 | body = { email: 'email', password: 'pass', username: 'username', name: 'email' } | |
89 | 97 | expect(a_post('/users').with(body: body)).to have_been_made |
90 | 98 | end |
91 | 99 |
33 | 33 | end |
34 | 34 | end |
35 | 35 | end |
36 | ||
37 | describe Gitlab::Error::ResponseError do | |
38 | before do | |
39 | @request_double = double('request', base_uri: 'https://gitlab.com/api/v3', path: '/foo', options: {}) | |
40 | end | |
41 | ||
42 | it 'Builds an error message from text' do | |
43 | headers = { 'content-type' => 'text/plain' } | |
44 | response_double = double('response', body: 'Retry later', to_s: 'Retry text', parsed_response: { message: 'Retry hash' }, code: 429, options: {}, headers: headers, request: @request_double) | |
45 | expect(described_class.new(response_double).send(:build_error_message)).to match(/Retry text/) | |
46 | end | |
47 | ||
48 | it 'Builds an error message from parsed json' do | |
49 | headers = { 'content-type' => 'application/json' } | |
50 | response_double = double('response', body: 'Retry later', to_s: 'Retry text', parsed_response: { message: 'Retry hash' }, code: 429, options: {}, headers: headers, request: @request_double) | |
51 | expect(described_class.new(response_double).send(:build_error_message)).to match(/Retry hash/) | |
52 | end | |
53 | end |
0 | # frozen_string_literal: true | |
1 | ||
0 | 2 | require 'spec_helper' |
1 | 3 | |
2 | 4 | describe Gitlab::FileResponse do |
3 | 5 | before do |
4 | @file_response = described_class.new StringIO.new('', 'rb+') | |
6 | @file_response = described_class.new StringIO.new(+'', 'rb+') | |
5 | 7 | end |
6 | 8 | |
7 | context '.empty?' do | |
9 | describe '.empty?' do | |
8 | 10 | it 'returns false' do |
9 | 11 | expect(@file_response.empty?).to be false |
10 | 12 | end |
11 | 13 | end |
12 | 14 | |
13 | context '.to_hash' do | |
15 | describe '.to_hash' do | |
14 | 16 | it 'has `filename` key and `data` key' do |
15 | 17 | h = @file_response.to_hash |
16 | 18 | expect(h).to be_key(:filename) |
18 | 20 | end |
19 | 21 | end |
20 | 22 | |
21 | context '.parse_headers!' do | |
23 | describe '.parse_headers!' do | |
22 | 24 | it 'parses headers' do |
23 | 25 | @file_response.parse_headers!('Content-Disposition' => 'attachment; filename=artifacts.zip') |
24 | 26 | expect(@file_response.filename).to eq 'artifacts.zip' |
0 | # frozen_string_literal: true | |
1 | ||
0 | 2 | require 'spec_helper' |
1 | 3 | |
2 | 4 | describe Gitlab::Help do |
25 | 27 | |
26 | 28 | it 'returns a String of modified output' do |
27 | 29 | described_class.change_help_output! @cmd, @help_output |
28 | expect(@help_output).to eq("Gitlab.create_branch 4 'new-branch' 'master'") | |
30 | expect(@help_output).to eq("Gitlab.create_branch(4, 'new-branch', 'master')") | |
29 | 31 | end |
32 | ||
30 | 33 | it 'formats options hash and return a String of modified output' do |
31 | 34 | described_class.change_help_output! 'groups', @help_output_with_options |
32 | expect(@help_output_with_options).to eq('Gitlab.groups "{ per_page: 3 }"') | |
35 | expect(@help_output_with_options).to eq('Gitlab.groups({ per_page: 3 })') | |
33 | 36 | end |
34 | 37 | end |
35 | 38 |
6 | 6 | @page_links = described_class.new('Link' => '<http://example.com/api/v3/projects?page=1&per_page=5>; rel="first", <http://example.com/api/v3/projects?page=20&per_page=5>; rel="last", <http://example.com/api/v3/projects?page=7&per_page=5>; rel="prev", <http://example.com/api/v3/projects?page=9&per_page=5>; rel="next"') |
7 | 7 | end |
8 | 8 | |
9 | context '.extract_links' do | |
9 | describe '.extract_links' do | |
10 | 10 | it 'extracts link header appropriately' do |
11 | 11 | expect(@page_links.last).to eql 'http://example.com/api/v3/projects?page=20&per_page=5' |
12 | 12 | expect(@page_links.first).to eql 'http://example.com/api/v3/projects?page=1&per_page=5' |
18 | 18 | expect(@paginated_response).to respond_to :has_prev_page? |
19 | 19 | end |
20 | 20 | |
21 | context '.parse_headers!' do | |
21 | describe '.parse_headers!' do | |
22 | 22 | it 'parses headers' do |
23 | 23 | @paginated_response.parse_headers!('Link' => '<http://example.com/api/v3/projects?page=1&per_page=5>; rel="first", <http://example.com/api/v3/projects?page=20&per_page=5>; rel="last"') |
24 | 24 | client = @paginated_response.client = double('client') |
38 | 38 | end |
39 | 39 | end |
40 | 40 | |
41 | context '.each_page' do | |
41 | describe '.each_page' do | |
42 | 42 | it 'iterates pages' do |
43 | 43 | next_page = double('next_page') |
44 | 44 | allow(@paginated_response).to receive(:has_next_page?).and_return(true) |
48 | 48 | end |
49 | 49 | end |
50 | 50 | |
51 | context '.auto_paginate' do | |
51 | describe '.auto_paginate' do | |
52 | 52 | it 'returns an array if block is not given' do |
53 | 53 | next_page = double('next_page') |
54 | 54 | allow(@paginated_response).to receive(:has_next_page?).and_return(true) |
58 | 58 | expect(@paginated_response.auto_paginate).to contain_exactly(1, 2, 3, 4, 5, 6, 7, 8) |
59 | 59 | end |
60 | 60 | end |
61 | ||
62 | shared_context 'when performing limited pagination returning an array' do | |
63 | before do | |
64 | next_page = double('next_page') | |
65 | allow(@paginated_response).to receive(:has_next_page?).and_return(true) | |
66 | allow(@paginated_response).to receive(:next_page).and_return(next_page) | |
67 | allow(next_page).to receive(:has_next_page?).and_return(false) | |
68 | allow(next_page).to receive(:to_ary).and_return([5, 6, 7, 8]) | |
69 | end | |
70 | end | |
71 | ||
72 | describe '.paginate_with_limit' do | |
73 | include_context 'when performing limited pagination returning an array' | |
74 | it 'returns a limited array' do | |
75 | expect(@paginated_response.paginate_with_limit(3)).to contain_exactly(1, 2, 3) | |
76 | end | |
77 | end | |
78 | ||
79 | describe '.paginate_with_limit' do | |
80 | include_context 'when performing limited pagination returning an array' | |
81 | it 'returns exactly the first page' do | |
82 | expect(@paginated_response.paginate_with_limit(4)).to contain_exactly(1, 2, 3, 4) | |
83 | end | |
84 | end | |
85 | ||
86 | describe '.paginate_with_limit' do | |
87 | it 'returns a page plus one' do | |
88 | next_page = double('next_page') | |
89 | allow(@paginated_response).to receive(:has_next_page?).and_return(true) | |
90 | allow(@paginated_response).to receive(:next_page).and_return(next_page) | |
91 | allow(next_page).to receive(:has_next_page?).and_return(false) | |
92 | allow(next_page).to receive(:[]).with(0, 1).and_return([5]) | |
93 | expect(@paginated_response.paginate_with_limit(5)).to contain_exactly(1, 2, 3, 4, 5) | |
94 | end | |
95 | end | |
96 | ||
97 | shared_context 'when performing limited pagination with a block' do | |
98 | before do | |
99 | next_page = double('next_page') | |
100 | allow(@paginated_response).to receive(:has_next_page?).and_return(true) | |
101 | allow(@paginated_response).to receive(:next_page).and_return(next_page) | |
102 | allow(next_page).to receive(:has_next_page?).and_return(false) | |
103 | allow(next_page).to receive(:each).and_yield(5).and_yield(6).and_yield(7).and_yield(8) | |
104 | end | |
105 | end | |
106 | ||
107 | describe '.paginate_with_limit' do | |
108 | include_context 'when performing limited pagination with a block' | |
109 | it 'iterates items with limit' do | |
110 | expect { |b| @paginated_response.paginate_with_limit(3, &b) }.to yield_successive_args(1, 2, 3) | |
111 | end | |
112 | end | |
113 | ||
114 | describe '.paginate_with_limit' do | |
115 | include_context 'when performing limited pagination with a block' | |
116 | it 'iterates exactly the first page' do | |
117 | expect { |b| @paginated_response.paginate_with_limit(4, &b) }.to yield_successive_args(1, 2, 3, 4) | |
118 | end | |
119 | end | |
120 | ||
121 | describe '.paginate_with_limit' do | |
122 | include_context 'when performing limited pagination with a block' | |
123 | it 'iterates the first page plus one' do | |
124 | expect { |b| @paginated_response.paginate_with_limit(5, &b) }.to yield_successive_args(1, 2, 3, 4, 5) | |
125 | end | |
126 | end | |
61 | 127 | end |
2 | 2 | require 'spec_helper' |
3 | 3 | |
4 | 4 | describe Gitlab::Request do |
5 | before do | |
6 | # Prevent tests modifying the `default_params` value from causing cross-test | |
7 | # pollution | |
8 | described_class.default_params.delete(:sudo) | |
9 | ||
10 | @request = described_class.new | |
11 | end | |
12 | ||
5 | 13 | it { is_expected.to respond_to :get } |
6 | 14 | it { is_expected.to respond_to :post } |
7 | 15 | it { is_expected.to respond_to :put } |
8 | 16 | it { is_expected.to respond_to :delete } |
9 | before do | |
10 | @request = described_class.new | |
11 | end | |
12 | 17 | |
13 | 18 | describe '.default_options' do |
14 | 19 | it 'has default values' do |
17 | 22 | expect(default_options[:parser]).to be_a Proc |
18 | 23 | expect(default_options[:format]).to eq(:json) |
19 | 24 | expect(default_options[:headers]).to eq('Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded') |
20 | expect(default_options[:default_params]).to be_nil | |
25 | expect(default_options[:default_params]).to be_empty | |
21 | 26 | end |
22 | 27 | end |
23 | 28 | |
54 | 59 | end |
55 | 60 | end |
56 | 61 | |
62 | describe 'HTTP request methods' do | |
63 | it 'does not overwrite headers set via HTTParty configuration' do | |
64 | @request.private_token = 'token' | |
65 | @request.endpoint = 'https://example.com/api/v4' | |
66 | path = "#{@request.endpoint}/version" | |
67 | ||
68 | # Stub Gitlab::Configuration | |
69 | allow(@request).to receive(:httparty).and_return( | |
70 | headers: { 'Cookie' => 'gitlab_canary=true' } | |
71 | ) | |
72 | ||
73 | stub_request(:get, path) | |
74 | @request.get('/version') | |
75 | ||
76 | expect(a_request(:get, path).with(headers: { | |
77 | 'PRIVATE_TOKEN' => 'token', | |
78 | 'Cookie' => 'gitlab_canary=true' | |
79 | }.merge(described_class.headers))).to have_been_made | |
80 | end | |
81 | ||
82 | it 'does not modify options in-place' do | |
83 | options = { per_page: 10 } | |
84 | original_options = options.dup | |
85 | ||
86 | @request.private_token = 'token' | |
87 | @request.endpoint = 'https://example.com/api/v4' | |
88 | ||
89 | # Stub Gitlab::Configuration | |
90 | allow(@request).to receive(:httparty).and_return(nil) | |
91 | ||
92 | stub_request(:get, "#{@request.endpoint}/projects") | |
93 | @request.get('/projects', options) | |
94 | ||
95 | expect(options).to eq(original_options) | |
96 | end | |
97 | end | |
98 | ||
57 | 99 | describe '#authorization_header' do |
58 | 100 | it 'raises MissingCredentials when auth_token and private_token are not set' do |
59 | 101 | expect do |
60 | @request.send(:authorization_header, {}) | |
102 | @request.send(:authorization_header) | |
61 | 103 | end.to raise_error(Gitlab::Error::MissingCredentials) |
62 | 104 | end |
63 | 105 | |
64 | 106 | it 'sets the correct header when given a private_token' do |
65 | 107 | @request.private_token = 'ys9BtunN3rDKbaJCYXaN' |
66 | expect(@request.send(:authorization_header, {})).to eq('PRIVATE-TOKEN' => 'ys9BtunN3rDKbaJCYXaN') | |
108 | expect(@request.send(:authorization_header)).to eq('PRIVATE-TOKEN' => 'ys9BtunN3rDKbaJCYXaN') | |
67 | 109 | end |
68 | 110 | |
69 | 111 | it 'sets the correct header when setting an auth_token via the private_token config option' do |
70 | 112 | @request.private_token = '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603' |
71 | expect(@request.send(:authorization_header, {})).to eq('Authorization' => 'Bearer 3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603') | |
113 | expect(@request.send(:authorization_header)).to eq('Authorization' => 'Bearer 3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603') | |
72 | 114 | end |
73 | 115 | end |
74 | 116 | end |
22 | 22 | it 'returns a Gitlab::Shell::History instance' do |
23 | 23 | expect(@history).to be_a Gitlab::Shell::History |
24 | 24 | end |
25 | ||
25 | 26 | it 'responds to :save' do |
26 | 27 | expect(@history).to respond_to :save |
27 | 28 | end |
29 | ||
28 | 30 | it 'responds to :load' do |
29 | 31 | expect(@history).to respond_to :load |
30 | 32 | end |
33 | ||
31 | 34 | it 'responds to :<<' do |
32 | 35 | expect(@history).to respond_to :<< |
33 | 36 | end |
39 | 42 | expect(completion).to be_truthy |
40 | 43 | expect(completion).to be_a Proc |
41 | 44 | end |
45 | ||
42 | 46 | it 'sets the Readline completion_append_character' do |
43 | 47 | completion_character = Readline.completion_append_character |
44 | 48 | expect(completion_character).to eq(' ') |
53 | 57 | it 'returns a Proc object' do |
54 | 58 | expect(@comp).to be_a Proc |
55 | 59 | end |
60 | ||
56 | 61 | context 'called with an argument' do |
57 | 62 | it 'returns an Array of matching commands' do |
58 | completed_cmds = @comp.call 'group' | |
63 | completed_cmds = @comp.call 'issue' | |
59 | 64 | expect(completed_cmds).to be_a Array |
60 | expect(completed_cmds.sort).to eq(%w[group group_access_requests group_member group_members group_milestone group_milestone_issues group_milestone_merge_requests group_milestones group_projects group_search group_subgroups group_variable group_variables groups]) | |
65 | expect(completed_cmds.sort).to eq(%w[issue issue_label_event issue_label_events issue_links issue_note issue_notes issues]) | |
61 | 66 | end |
62 | 67 | end |
63 | 68 | end |