gitlab 4.8.0 → 4.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -7
- data/lib/gitlab/cli.rb +0 -3
- data/lib/gitlab/cli_helpers.rb +11 -10
- data/lib/gitlab/client.rb +15 -0
- data/lib/gitlab/client/application_settings.rb +172 -0
- data/lib/gitlab/client/avatar.rb +21 -0
- data/lib/gitlab/client/boards.rb +56 -0
- data/lib/gitlab/client/build_variables.rb +14 -10
- data/lib/gitlab/client/commits.rb +18 -2
- data/lib/gitlab/client/container_registry.rb +85 -0
- data/lib/gitlab/client/epics.rb +73 -0
- data/lib/gitlab/client/features.rb +48 -0
- data/lib/gitlab/client/group_boards.rb +141 -0
- data/lib/gitlab/client/group_labels.rb +88 -0
- data/lib/gitlab/client/groups.rb +66 -2
- data/lib/gitlab/client/issue_links.rb +48 -0
- data/lib/gitlab/client/labels.rb +1 -1
- data/lib/gitlab/client/lint.rb +19 -0
- data/lib/gitlab/client/markdown.rb +23 -0
- data/lib/gitlab/client/merge_request_approvals.rb +9 -8
- data/lib/gitlab/client/merge_requests.rb +12 -0
- data/lib/gitlab/client/notes.rb +1 -1
- data/lib/gitlab/client/pipelines.rb +12 -0
- data/lib/gitlab/client/project_clusters.rb +83 -0
- data/lib/gitlab/client/project_release_links.rb +76 -0
- data/lib/gitlab/client/project_releases.rb +79 -0
- data/lib/gitlab/client/projects.rb +27 -6
- data/lib/gitlab/client/repositories.rb +5 -3
- data/lib/gitlab/client/repository_files.rb +16 -0
- data/lib/gitlab/client/resource_label_events.rb +82 -0
- data/lib/gitlab/client/runners.rb +49 -2
- data/lib/gitlab/client/search.rb +66 -0
- data/lib/gitlab/client/users.rb +7 -9
- data/lib/gitlab/configuration.rb +1 -1
- data/lib/gitlab/error.rb +46 -1
- data/lib/gitlab/paginated_response.rb +19 -0
- data/lib/gitlab/request.rb +15 -25
- data/lib/gitlab/shell_history.rb +4 -8
- data/lib/gitlab/version.rb +1 -1
- metadata +33 -15
- data/.github/stale.yml +0 -18
- data/.gitignore +0 -22
- data/.rubocop_todo.yml +0 -46
- data/CONTRIBUTING.md +0 -195
- data/Gemfile +0 -6
- data/Rakefile +0 -15
- data/bin/console +0 -11
- data/bin/setup +0 -6
- data/gitlab.gemspec +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eea71e433b574497741d1e8f523d6a2a61c4fb423d821b7d3424a4cde6adadc3
|
4
|
+
data.tar.gz: ec2829e6dc0a9efa88568389bb11dba0290b4e7bec476d790203afa915e633f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14a2e907533256d02b6b1524c6cd25ced84dfe16ed8bed1298c85ae024adcf2c939548eedba23cd3a34865e435aaee8ed2de2cc05d6ad5e5aa9899ef01e81abc
|
7
|
+
data.tar.gz: 03ece4a5d5801a7e263c450c6164d260b0abd92f8973cf352f729e66740464f64b9836c85d3ad111a8234bb99ff3eea2738cc2f9e213d85dc8eada4f50852174
|
data/README.md
CHANGED
@@ -7,11 +7,11 @@
|
|
7
7
|
[![License](https://img.shields.io/badge/license-BSD-red.svg)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt)
|
8
8
|
|
9
9
|
[website](https://narkoz.github.io/gitlab) |
|
10
|
-
[documentation](https://rubydoc.info/gems/gitlab/frames) |
|
10
|
+
[documentation](https://www.rubydoc.info/gems/gitlab/frames) |
|
11
11
|
[gitlab-live](https://github.com/NARKOZ/gitlab-live)
|
12
12
|
|
13
13
|
Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html).
|
14
|
-
As of version `4.0.0` this gem only supports
|
14
|
+
As of version `4.0.0` this gem only supports GitLab API v4.
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
@@ -40,7 +40,7 @@ Configuration example:
|
|
40
40
|
|
41
41
|
```ruby
|
42
42
|
Gitlab.configure do |config|
|
43
|
-
config.endpoint = 'https://example.net/api/v4' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT']
|
43
|
+
config.endpoint = 'https://example.net/api/v4' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] and falls back to ENV['CI_API_V4_URL']
|
44
44
|
config.private_token = 'qEsq1pt6HJPaNciie3MG' # user's private token or OAuth2 access token, default: ENV['GITLAB_API_PRIVATE_TOKEN']
|
45
45
|
# Optional
|
46
46
|
# config.user_agent = 'Custom User Agent' # user agent, default: 'Gitlab Ruby Gem [version]'
|
@@ -72,8 +72,14 @@ ENV['GITLAB_API_HTTPARTY_OPTIONS'] = '{read_timeout: 60}'
|
|
72
72
|
Gitlab.projects(per_page: 5)
|
73
73
|
# => [#<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"}>]
|
74
74
|
|
75
|
-
# initialize a new client
|
76
|
-
g = Gitlab.client(
|
75
|
+
# initialize a new client with custom headers
|
76
|
+
g = Gitlab.client(
|
77
|
+
endpoint: 'https://example.com/api/v4',
|
78
|
+
private_token: 'qEsq1pt6HJPaNciie3MG',
|
79
|
+
httparty: {
|
80
|
+
headers: { 'Cookie' => 'gitlab_canary=true' }
|
81
|
+
}
|
82
|
+
)
|
77
83
|
# => #<Gitlab::Client:0x00000001e62408 @endpoint="https://api.example.com", @private_token="qEsq1pt6HJPaNciie3MG", @user_agent="Gitlab Ruby Gem 2.0.0">
|
78
84
|
|
79
85
|
# get a user
|
@@ -110,14 +116,14 @@ end
|
|
110
116
|
projects.auto_paginate
|
111
117
|
```
|
112
118
|
|
113
|
-
For more information, refer to [documentation](https://rubydoc.info/gems/gitlab/frames).
|
119
|
+
For more information, refer to [documentation](https://www.rubydoc.info/gems/gitlab/frames).
|
114
120
|
|
115
121
|
## CLI
|
116
122
|
|
117
123
|
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:
|
118
124
|
```sh
|
119
125
|
export GITLAB_API_ENDPOINT=https://gitlab.yourcompany.com/api/v4
|
120
|
-
export GITLAB_API_PRIVATE_TOKEN=<your private token from /profile/account>
|
126
|
+
export GITLAB_API_PRIVATE_TOKEN=<your private token from /profile/account or /profile/personal_access_tokens in newer version>
|
121
127
|
# This one is optional and can be used to set any HTTParty option you may need
|
122
128
|
# using YAML hash syntax. For example, this is how you would disable SSL
|
123
129
|
# verification (useful if using a self-signed cert).
|
data/lib/gitlab/cli.rb
CHANGED
data/lib/gitlab/cli_helpers.rb
CHANGED
@@ -39,22 +39,23 @@ class Gitlab::CLI
|
|
39
39
|
#
|
40
40
|
# @return [Array]
|
41
41
|
def required_fields(args)
|
42
|
-
|
43
|
-
args.last.gsub('--only=', '').split(',')
|
44
|
-
else
|
45
|
-
[]
|
46
|
-
end
|
42
|
+
filtered_fields(args, '--only=')
|
47
43
|
end
|
48
44
|
|
49
45
|
# Returns filtered excluded fields.
|
50
46
|
#
|
51
47
|
# @return [Array]
|
52
48
|
def excluded_fields(args)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
49
|
+
filtered_fields(args, '--except=')
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns fields filtered by a keyword.
|
53
|
+
#
|
54
|
+
# @return [Array]
|
55
|
+
def filtered_fields(args, key)
|
56
|
+
return [] unless args.any? && args.last.is_a?(String) && args.last.start_with?(key)
|
57
|
+
|
58
|
+
args.last.gsub(key, '').split(',')
|
58
59
|
end
|
59
60
|
|
60
61
|
# Confirms command is valid.
|
data/lib/gitlab/client.rb
CHANGED
@@ -7,6 +7,8 @@ module Gitlab
|
|
7
7
|
|
8
8
|
# Please keep in alphabetical order
|
9
9
|
include AccessRequests
|
10
|
+
include ApplicationSettings
|
11
|
+
include Avatar
|
10
12
|
include AwardEmojis
|
11
13
|
include Boards
|
12
14
|
include Branches
|
@@ -14,15 +16,23 @@ module Gitlab
|
|
14
16
|
include BuildVariables
|
15
17
|
include Builds
|
16
18
|
include Commits
|
19
|
+
include ContainerRegistry
|
17
20
|
include Deployments
|
18
21
|
include Environments
|
22
|
+
include Epics
|
19
23
|
include Events
|
24
|
+
include Features
|
25
|
+
include GroupBoards
|
26
|
+
include GroupLabels
|
20
27
|
include GroupMilestones
|
21
28
|
include Groups
|
29
|
+
include IssueLinks
|
22
30
|
include Issues
|
23
31
|
include Jobs
|
24
32
|
include Keys
|
25
33
|
include Labels
|
34
|
+
include Lint
|
35
|
+
include Markdown
|
26
36
|
include MergeRequestApprovals
|
27
37
|
include MergeRequests
|
28
38
|
include Milestones
|
@@ -32,12 +42,17 @@ module Gitlab
|
|
32
42
|
include PipelineTriggers
|
33
43
|
include Pipelines
|
34
44
|
include ProjectBadges
|
45
|
+
include ProjectClusters
|
46
|
+
include ProjectReleaseLinks
|
47
|
+
include ProjectReleases
|
35
48
|
include Projects
|
36
49
|
include ProtectedTags
|
37
50
|
include Repositories
|
38
51
|
include RepositoryFiles
|
39
52
|
include RepositorySubmodules
|
53
|
+
include ResourceLabelEvents
|
40
54
|
include Runners
|
55
|
+
include Search
|
41
56
|
include Services
|
42
57
|
include Sidekiq
|
43
58
|
include Snippets
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to application settings.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/settings.html
|
6
|
+
module ApplicationSettings
|
7
|
+
# Retrives the application settings of Gitlab.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.application_settings
|
11
|
+
#
|
12
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
13
|
+
def application_settings
|
14
|
+
get('/application/settings')
|
15
|
+
end
|
16
|
+
|
17
|
+
# Edit the applications settings of Gitlab.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# Gitlab.edit_application_settings({ signup_enabled: false })
|
21
|
+
#
|
22
|
+
# @param [Hash] options A customizable set of options.
|
23
|
+
# @option options [String] :admin_notification_email
|
24
|
+
# @option options [String] :after_sign_out_path
|
25
|
+
# @option options [String] :after_sign_up_text
|
26
|
+
# @option options [String] :akismet_api_key
|
27
|
+
# @option options [Boolean] :akismet_enabled
|
28
|
+
# @option options [Boolean] :allow_group_owners_to_manage_ldap
|
29
|
+
# @option options [Boolean] :allow_local_requests_from_hooks_and_services
|
30
|
+
# @option options [Boolean] :authorized_keys_enabled
|
31
|
+
# @option options [String] :auto_devops_domain
|
32
|
+
# @option options [Boolean] :auto_devops_enabled
|
33
|
+
# @option options [Boolean] :check_namespace_plan
|
34
|
+
# @option options [String] :clientside_sentry_dsn
|
35
|
+
# @option options [Boolean] :clientside_sentry_enabled
|
36
|
+
# @option options [Integer] :container_registry_token_expire_delay
|
37
|
+
# @option options [String] :default_artifacts_expire_in
|
38
|
+
# @option options [Integer] :default_branch_protection
|
39
|
+
# @option options [String] :default_group_visibility
|
40
|
+
# @option options [String] :default_project_visibility
|
41
|
+
# @option options [Integer] :default_projects_limit
|
42
|
+
# @option options [String] :default_snippet_visibility
|
43
|
+
# @option options [Array<String>] :disabled_oauth_sign_in_sources
|
44
|
+
# @option options [Array<String>] :domain_blacklist
|
45
|
+
# @option options [Boolean] :domain_blacklist_enabled
|
46
|
+
# @option options [Array<String>] :domain_whitelist
|
47
|
+
# @option options [Integer] :dsa_key_restriction
|
48
|
+
# @option options [Integer] :ecdsa_key_restriction
|
49
|
+
# @option options [Integer] :ed25519_key_restriction
|
50
|
+
# @option options [Boolean] :elasticsearch_aws
|
51
|
+
# @option options [String] :elasticsearch_aws_access_key
|
52
|
+
# @option options [String] :elasticsearch_aws_region
|
53
|
+
# @option options [String] :elasticsearch_aws_secret_access_key
|
54
|
+
# @option options [Boolean] :elasticsearch_experimental_indexer
|
55
|
+
# @option options [Boolean] :elasticsearch_indexing
|
56
|
+
# @option options [Boolean] :elasticsearch_search
|
57
|
+
# @option options [String] :elasticsearch_url
|
58
|
+
# @option options [Boolean] :elasticsearch_limit_indexing
|
59
|
+
# @option options [Array<Integer>] :elasticsearch_project_ids
|
60
|
+
# @option options [Array<Integer>] :elasticsearch_namespace_ids
|
61
|
+
# @option options [String] :email_additional_text
|
62
|
+
# @option options [Boolean] :email_author_in_body
|
63
|
+
# @option options [String] :enabled_git_access_protocol
|
64
|
+
# @option options [Boolean] :enforce_terms
|
65
|
+
# @option options [String] :external_auth_client_cert
|
66
|
+
# @option options [String] :external_auth_client_key
|
67
|
+
# @option options [String] :external_auth_client_key_pass
|
68
|
+
# @option options [Boolean] :external_authorization_service_enabled
|
69
|
+
# @option options [String] :external_authorization_service_default_label
|
70
|
+
# @option options [Float] :external_authorization_service_timeout float
|
71
|
+
# @option options [String] :external_authorization_service_url
|
72
|
+
# @option options [Integer] :file_template_project_id
|
73
|
+
# @option options [Integer] :first_day_of_week
|
74
|
+
# @option options [Integer] :geo_status_timeout
|
75
|
+
# @option options [Integer] :gitaly_timeout_default
|
76
|
+
# @option options [Integer] :gitaly_timeout_fast
|
77
|
+
# @option options [Integer] :gitaly_timeout_medium
|
78
|
+
# @option options [Boolean] :gravatar_enabled
|
79
|
+
# @option options [Boolean] :hashed_storage_enabled
|
80
|
+
# @option options [Boolean] :help_page_hide_commercial_content
|
81
|
+
# @option options [String] :help_page_support_url
|
82
|
+
# @option options [String] :help_page_text
|
83
|
+
# @option options [String] :help_text
|
84
|
+
# @option options [Boolean] :hide_third_party_offers
|
85
|
+
# @option options [String] :home_page_url
|
86
|
+
# @option options [Boolean] :housekeeping_bitmaps_enabled
|
87
|
+
# @option options [Boolean] :housekeeping_enabled
|
88
|
+
# @option options [Integer] :housekeeping_full_repack_period
|
89
|
+
# @option options [Integer] :housekeeping_gc_period
|
90
|
+
# @option options [Integer] :housekeeping_incremental_repack_period
|
91
|
+
# @option options [Boolean] :html_emails_enabled
|
92
|
+
# @option options [Boolean] :instance_statistics_visibility_private
|
93
|
+
# @option options [Array<String>] :import_sources
|
94
|
+
# @option options [Integer] :max_artifacts_size
|
95
|
+
# @option options [Integer] :max_attachment_size
|
96
|
+
# @option options [Integer] :max_pages_size
|
97
|
+
# @option options [Boolean] :metrics_enabled
|
98
|
+
# @option options [String] :metrics_host
|
99
|
+
# @option options [Integer] :metrics_method_call_threshold
|
100
|
+
# @option options [Integer] :metrics_packet_size
|
101
|
+
# @option options [Integer] :metrics_pool_size
|
102
|
+
# @option options [Integer] :metrics_port
|
103
|
+
# @option options [Integer] :metrics_sample_interval
|
104
|
+
# @option options [Integer] :metrics_timeout
|
105
|
+
# @option options [Boolean] :mirror_available
|
106
|
+
# @option options [Integer] :mirror_capacity_threshold
|
107
|
+
# @option options [Integer] :mirror_max_capacity
|
108
|
+
# @option options [Integer] :mirror_max_delay
|
109
|
+
# @option options [Boolean] :pages_domain_verification_enabled
|
110
|
+
# @option options [Boolean] :password_authentication_enabled_for_git
|
111
|
+
# @option options [Boolean] :password_authentication_enabled_for_web
|
112
|
+
# @option options [String] :performance_bar_allowed_group_id
|
113
|
+
# @option options [String] :performance_bar_allowed_group_path
|
114
|
+
# @option options [Boolean] :performance_bar_enabled
|
115
|
+
# @option options [Boolean] :plantuml_enabled
|
116
|
+
# @option options [String] :plantuml_url
|
117
|
+
# @option options [Float] :polling_interval_multiplier
|
118
|
+
# @option options [Boolean] :project_export_enabled
|
119
|
+
# @option options [Boolean] :prometheus_metrics_enabled
|
120
|
+
# @option options [Boolean] :pseudonymizer_enabled
|
121
|
+
# @option options [Boolean] :recaptcha_enabled
|
122
|
+
# @option options [String] :recaptcha_private_key
|
123
|
+
# @option options [String] :recaptcha_site_key
|
124
|
+
# @option options [Boolean] :repository_checks_enabled
|
125
|
+
# @option options [Integer] :repository_size_limit
|
126
|
+
# @option options [Array<String>] :repository_storages
|
127
|
+
# @option options [Boolean] :require_two_factor_authentication
|
128
|
+
# @option options [Array<String>] :restricted_visibility_levels
|
129
|
+
# @option options [Integer] :rsa_key_restriction
|
130
|
+
# @option options [Boolean] :send_user_confirmation_email
|
131
|
+
# @option options [String] :sentry_dsn
|
132
|
+
# @option options [Boolean] :sentry_enabled
|
133
|
+
# @option options [Integer] :session_expire_delay
|
134
|
+
# @option options [Boolean] :shared_runners_enabled
|
135
|
+
# @option options [Integer] :shared_runners_minutes
|
136
|
+
# @option options [String] :shared_runners_text
|
137
|
+
# @option options [String] :sign_in_text
|
138
|
+
# @option options [String] :signin_enabled
|
139
|
+
# @option options [Boolean] :signup_enabled
|
140
|
+
# @option options [Boolean] :slack_app_enabled
|
141
|
+
# @option options [String] :slack_app_id
|
142
|
+
# @option options [String] :slack_app_secret
|
143
|
+
# @option options [String] :slack_app_verification_token
|
144
|
+
# @option options [Integer] :terminal_max_session_time
|
145
|
+
# @option options [String] :terms
|
146
|
+
# @option options [Boolean] :throttle_authenticated_api_enabled
|
147
|
+
# @option options [Integer] :throttle_authenticated_api_period_in_seconds
|
148
|
+
# @option options [Integer] :throttle_authenticated_api_requests_per_period
|
149
|
+
# @option options [Boolean] :throttle_authenticated_web_enabled
|
150
|
+
# @option options [Integer] :throttle_authenticated_web_period_in_seconds
|
151
|
+
# @option options [Integer] :throttle_authenticated_web_requests_per_period
|
152
|
+
# @option options [Boolean] :throttle_unauthenticated_enabled
|
153
|
+
# @option options [Integer] :throttle_unauthenticated_period_in_seconds
|
154
|
+
# @option options [Integer] :throttle_unauthenticated_requests_per_period
|
155
|
+
# @option options [Integer] :two_factor_grace_period
|
156
|
+
# @option options [Boolean] :unique_ips_limit_enabled
|
157
|
+
# @option options [Integer] :unique_ips_limit_per_user
|
158
|
+
# @option options [Integer] :unique_ips_limit_time_window
|
159
|
+
# @option options [Boolean] :usage_ping_enabled
|
160
|
+
# @option options [Boolean] :user_default_external
|
161
|
+
# @option options [Boolean] :user_oauth_applications
|
162
|
+
# @option options [Boolean] :user_show_add_ssh_key_message
|
163
|
+
# @option options [Boolean] :version_check_enabled
|
164
|
+
# @option options [Integer] :local_markdown_version
|
165
|
+
# @option options [String] :geo_node_allowed_ips
|
166
|
+
#
|
167
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
168
|
+
def edit_application_settings(options = {})
|
169
|
+
put('/application/settings', body: options)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to avatar.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/avatar.html
|
6
|
+
module Avatar
|
7
|
+
# Get a single avatar URL for a user with the given email address.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.avatar(email: 'admin@example.com')
|
11
|
+
# Gitlab.avatar(email: 'admin@example.com', size: 32)
|
12
|
+
#
|
13
|
+
# @param [Hash] options A customizable set of options.
|
14
|
+
# @option options [String] :email(required) Public email address of the user.
|
15
|
+
# @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.
|
16
|
+
# @return <Gitlab::ObjectifiedHash>
|
17
|
+
def avatar(options = {})
|
18
|
+
get('/avatar', query: options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/gitlab/client/boards.rb
CHANGED
@@ -19,6 +19,62 @@ class Gitlab::Client
|
|
19
19
|
get("/projects/#{url_encode project}/boards", query: options)
|
20
20
|
end
|
21
21
|
|
22
|
+
# Get a single board.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.board(5, 1)
|
26
|
+
#
|
27
|
+
# @param [Integer, String] project The ID or name of a project.
|
28
|
+
# @param [Integer] id The ID of a board.
|
29
|
+
# @return [Gitlab::ObjectifiedHash] Returns information about the board
|
30
|
+
def board(project, id)
|
31
|
+
get("/projects/#{url_encode project}/boards/#{id}")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Creates a new board.
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# Gitlab.create_board(5, 'newboard')
|
38
|
+
#
|
39
|
+
# @param [Integer, String] project The ID or name of a project.
|
40
|
+
# @param [String] name The name of the new board.
|
41
|
+
# @return [Gitlab::ObjectifiedHash] Information about created board.
|
42
|
+
def create_board(project, name)
|
43
|
+
body = { name: name }
|
44
|
+
post("/projects/#{url_encode project}/boards", body: body)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Updates a board.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# Gitlab.edit_board(5, 1, name: 'new_name')
|
51
|
+
# Gitlab.edit_board(5, 1, name: 'new_name', assignee_id: 1, milestone_id: 1)
|
52
|
+
#
|
53
|
+
# @param [Integer, String] project The ID or name of a project.
|
54
|
+
# @param [Integer] id The ID of a board.
|
55
|
+
# @param [Hash] options A customizable set of options.
|
56
|
+
# @option options [String] :name(optional) The new name of the board.
|
57
|
+
# @option options [Integer] :assignee_id(optional) The assignee the board should be scoped to.
|
58
|
+
# @option options [Integer] :milestone_id(optional) The milestone the board should be scoped to.
|
59
|
+
# @option options [String] :labels(optional) Comma-separated list of label names which the board should be scoped to.
|
60
|
+
# @option options [Integer] :weight(optional) The weight range from 0 to 9, to which the board should be scoped to.
|
61
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated board.
|
62
|
+
def edit_board(project, id, options = {})
|
63
|
+
put("/projects/#{url_encode project}/boards/#{id}", body: options)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Deletes a board.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# Gitlab.delete_board(5, 1)
|
70
|
+
#
|
71
|
+
# @param [Integer, String] project The ID or name of a project.
|
72
|
+
# @param [Integer] id The ID of a board.
|
73
|
+
# @return [void] This API call returns an empty response body.
|
74
|
+
def delete_board(project, id)
|
75
|
+
delete("/projects/#{url_encode project}/boards/#{id}")
|
76
|
+
end
|
77
|
+
|
22
78
|
# Gets a board lists
|
23
79
|
#
|
24
80
|
# @example
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
class Gitlab::Client
|
4
4
|
# Defines methods related to builds.
|
5
|
-
# @see https://docs.gitlab.com/ce/api/
|
6
|
-
# @see https://docs.gitlab.com/
|
5
|
+
# @see https://docs.gitlab.com/ce/api/project_level_variables.html
|
6
|
+
# @see https://docs.gitlab.com/ce/api/group_level_variables.html
|
7
7
|
module BuildVariables
|
8
8
|
# Gets a list of the project's build variables
|
9
9
|
#
|
@@ -36,9 +36,10 @@ class Gitlab::Client
|
|
36
36
|
# @param [Integer, String] project The ID or name of a project.
|
37
37
|
# @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
|
38
38
|
# @param [String] value The value of a variable
|
39
|
+
# @param [Hash] opts optional parameters
|
39
40
|
# @return [Gitlab::ObjectifiedHash] The variable.
|
40
|
-
def create_variable(project, key, value)
|
41
|
-
post("/projects/#{url_encode project}/variables", body:
|
41
|
+
def create_variable(project, key, value, **opts)
|
42
|
+
post("/projects/#{url_encode project}/variables", body: opts.merge(key: key, value: value))
|
42
43
|
end
|
43
44
|
|
44
45
|
# Update a project's build variable.
|
@@ -49,9 +50,10 @@ class Gitlab::Client
|
|
49
50
|
# @param [Integer, String] project The ID or name of a project.
|
50
51
|
# @param [String] key The key of a variable
|
51
52
|
# @param [String] value The value of a variable
|
53
|
+
# @param [Hash] opts optional parameters
|
52
54
|
# @return [Gitlab::ObjectifiedHash] The variable.
|
53
|
-
def update_variable(project, key, value)
|
54
|
-
put("/projects/#{url_encode project}/variables/#{key}", body:
|
55
|
+
def update_variable(project, key, value, **opts)
|
56
|
+
put("/projects/#{url_encode project}/variables/#{key}", body: opts.merge(value: value))
|
55
57
|
end
|
56
58
|
|
57
59
|
# Remove a project's build variable.
|
@@ -97,9 +99,10 @@ class Gitlab::Client
|
|
97
99
|
# @param [Integer, String] group The ID or name of a group.
|
98
100
|
# @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
|
99
101
|
# @param [String] value The value of a variable
|
102
|
+
# @param [Hash] opts optional parameters
|
100
103
|
# @return [Gitlab::ObjectifiedHash] The variable.
|
101
|
-
def create_group_variable(group, key, value)
|
102
|
-
post("/groups/#{url_encode group}/variables", body:
|
104
|
+
def create_group_variable(group, key, value, **opts)
|
105
|
+
post("/groups/#{url_encode group}/variables", body: opts.merge(key: key, value: value))
|
103
106
|
end
|
104
107
|
|
105
108
|
# Update a group's build variable.
|
@@ -110,9 +113,10 @@ class Gitlab::Client
|
|
110
113
|
# @param [Integer, String] group The ID or name of a group.
|
111
114
|
# @param [String] key The key of a variable
|
112
115
|
# @param [String] value The value of a variable
|
116
|
+
# @param [Hash] opts optional parameters
|
113
117
|
# @return [Gitlab::ObjectifiedHash] The variable.
|
114
|
-
def update_group_variable(group, key, value)
|
115
|
-
put("/groups/#{url_encode group}/variables/#{key}", body:
|
118
|
+
def update_group_variable(group, key, value, **opts)
|
119
|
+
put("/groups/#{url_encode group}/variables/#{key}", body: opts.merge(value: value))
|
116
120
|
end
|
117
121
|
|
118
122
|
# Remove a group's build variable.
|