gitlab 4.5.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +0 -267
  3. data/LICENSE.txt +1 -1
  4. data/README.md +40 -30
  5. data/exe/gitlab +5 -1
  6. data/lib/gitlab/api.rb +7 -3
  7. data/lib/gitlab/cli.rb +13 -9
  8. data/lib/gitlab/cli_helpers.rb +49 -45
  9. data/lib/gitlab/client/access_requests.rb +10 -1
  10. data/lib/gitlab/client/application_settings.rb +172 -0
  11. data/lib/gitlab/client/avatar.rb +21 -0
  12. data/lib/gitlab/client/award_emojis.rb +5 -3
  13. data/lib/gitlab/client/boards.rb +62 -4
  14. data/lib/gitlab/client/branches.rb +47 -8
  15. data/lib/gitlab/client/broadcast_messages.rb +75 -0
  16. data/lib/gitlab/client/build_variables.rb +19 -12
  17. data/lib/gitlab/client/builds.rb +13 -11
  18. data/lib/gitlab/client/commits.rb +73 -21
  19. data/lib/gitlab/client/container_registry.rb +85 -0
  20. data/lib/gitlab/client/deployments.rb +3 -1
  21. data/lib/gitlab/client/environments.rb +5 -3
  22. data/lib/gitlab/client/epic_issues.rb +23 -0
  23. data/lib/gitlab/client/epics.rb +73 -0
  24. data/lib/gitlab/client/events.rb +6 -4
  25. data/lib/gitlab/client/features.rb +48 -0
  26. data/lib/gitlab/client/group_badges.rb +88 -0
  27. data/lib/gitlab/client/group_boards.rb +141 -0
  28. data/lib/gitlab/client/group_labels.rb +88 -0
  29. data/lib/gitlab/client/group_milestones.rb +7 -6
  30. data/lib/gitlab/client/groups.rb +326 -12
  31. data/lib/gitlab/client/issue_links.rb +48 -0
  32. data/lib/gitlab/client/issues.rb +47 -13
  33. data/lib/gitlab/client/jobs.rb +96 -8
  34. data/lib/gitlab/client/keys.rb +13 -0
  35. data/lib/gitlab/client/labels.rb +6 -4
  36. data/lib/gitlab/client/lint.rb +19 -0
  37. data/lib/gitlab/client/markdown.rb +23 -0
  38. data/lib/gitlab/client/merge_request_approvals.rb +164 -9
  39. data/lib/gitlab/client/merge_requests.rb +148 -11
  40. data/lib/gitlab/client/merge_trains.rb +55 -0
  41. data/lib/gitlab/client/milestones.rb +19 -5
  42. data/lib/gitlab/client/namespaces.rb +4 -2
  43. data/lib/gitlab/client/notes.rb +38 -9
  44. data/lib/gitlab/client/packages.rb +95 -0
  45. data/lib/gitlab/client/pipeline_schedules.rb +36 -10
  46. data/lib/gitlab/client/pipeline_triggers.rb +10 -8
  47. data/lib/gitlab/client/pipelines.rb +65 -3
  48. data/lib/gitlab/client/project_badges.rb +85 -0
  49. data/lib/gitlab/client/project_clusters.rb +83 -0
  50. data/lib/gitlab/client/project_exports.rb +54 -0
  51. data/lib/gitlab/client/project_release_links.rb +76 -0
  52. data/lib/gitlab/client/project_releases.rb +90 -0
  53. data/lib/gitlab/client/projects.rb +307 -26
  54. data/lib/gitlab/client/protected_tags.rb +59 -0
  55. data/lib/gitlab/client/remote_mirrors.rb +51 -0
  56. data/lib/gitlab/client/repositories.rb +77 -6
  57. data/lib/gitlab/client/repository_files.rb +21 -3
  58. data/lib/gitlab/client/repository_submodules.rb +27 -0
  59. data/lib/gitlab/client/resource_label_events.rb +82 -0
  60. data/lib/gitlab/client/resource_state_events.rb +57 -0
  61. data/lib/gitlab/client/runners.rb +170 -18
  62. data/lib/gitlab/client/search.rb +66 -0
  63. data/lib/gitlab/client/services.rb +4 -1
  64. data/lib/gitlab/client/sidekiq.rb +2 -0
  65. data/lib/gitlab/client/snippets.rb +5 -3
  66. data/lib/gitlab/client/system_hooks.rb +9 -7
  67. data/lib/gitlab/client/tags.rb +10 -9
  68. data/lib/gitlab/client/templates.rb +100 -0
  69. data/lib/gitlab/client/todos.rb +7 -5
  70. data/lib/gitlab/client/user_snippets.rb +114 -0
  71. data/lib/gitlab/client/users.rb +302 -31
  72. data/lib/gitlab/client/versions.rb +18 -0
  73. data/lib/gitlab/client/wikis.rb +79 -0
  74. data/lib/gitlab/client.rb +48 -9
  75. data/lib/gitlab/configuration.rb +9 -6
  76. data/lib/gitlab/error.rb +73 -3
  77. data/lib/gitlab/file_response.rb +4 -2
  78. data/lib/gitlab/headers/page_links.rb +37 -0
  79. data/lib/gitlab/headers/total.rb +29 -0
  80. data/lib/gitlab/help.rb +16 -16
  81. data/lib/gitlab/objectified_hash.rb +27 -10
  82. data/lib/gitlab/paginated_response.rb +43 -25
  83. data/lib/gitlab/request.rb +51 -37
  84. data/lib/gitlab/shell.rb +6 -4
  85. data/lib/gitlab/shell_history.rb +11 -13
  86. data/lib/gitlab/version.rb +3 -1
  87. data/lib/gitlab.rb +23 -9
  88. metadata +59 -45
  89. data/.gitignore +0 -22
  90. data/CONTRIBUTING.md +0 -195
  91. data/Gemfile +0 -4
  92. data/Rakefile +0 -17
  93. data/bin/console +0 -10
  94. data/bin/setup +0 -6
  95. data/gitlab.gemspec +0 -33
  96. data/lib/gitlab/page_links.rb +0 -33
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'json'
3
5
  require 'base64'
@@ -5,7 +7,7 @@ require 'base64'
5
7
  class Gitlab::CLI
6
8
  # Defines methods related to CLI output and formatting.
7
9
  module Helpers
8
- extend self
10
+ module_function
9
11
 
10
12
  # Returns actions available to CLI & Shell
11
13
  #
@@ -18,7 +20,7 @@ class Gitlab::CLI
18
20
  #
19
21
  # @return [Gitlab::Client]
20
22
  def client
21
- @client ||= Gitlab::Client.new(endpoint: (Gitlab.endpoint || ''))
23
+ @client ||= Gitlab::Client.new(endpoint: Gitlab.endpoint || '')
22
24
  end
23
25
 
24
26
  # Returns method names and their owners
@@ -37,22 +39,23 @@ class Gitlab::CLI
37
39
  #
38
40
  # @return [Array]
39
41
  def required_fields(args)
40
- if args.any? && args.last.is_a?(String) && args.last.start_with?('--only=')
41
- args.last.gsub('--only=', '').split(',')
42
- else
43
- []
44
- end
42
+ filtered_fields(args, '--only=')
45
43
  end
46
44
 
47
45
  # Returns filtered excluded fields.
48
46
  #
49
47
  # @return [Array]
50
48
  def excluded_fields(args)
51
- if args.any? && args.last.is_a?(String) && args.last.start_with?('--except=')
52
- args.last.gsub('--except=', '').split(',')
53
- else
54
- []
55
- end
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(',')
56
59
  end
57
60
 
58
61
  # Confirms command is valid.
@@ -71,7 +74,7 @@ class Gitlab::CLI
71
74
 
72
75
  puts 'Are you sure? (y/n)'
73
76
 
74
- if %w(y yes).include?($stdin.gets.to_s.strip.downcase)
77
+ if %w[y yes].include?($stdin.gets.to_s.strip.downcase)
75
78
  puts 'Proceeding..'
76
79
  else
77
80
  puts 'Command aborted.'
@@ -82,7 +85,7 @@ class Gitlab::CLI
82
85
  # Gets defined help for a specific command/action.
83
86
  #
84
87
  # @return [String]
85
- def help(cmd=nil, &block)
88
+ def help(cmd = nil, &block)
86
89
  if cmd.nil? || Gitlab::Help.help_map.key?(cmd)
87
90
  Gitlab::Help.actions_table(cmd)
88
91
  else
@@ -90,14 +93,14 @@ class Gitlab::CLI
90
93
  end
91
94
  end
92
95
 
93
- # Outputs a nicely formatted table or error msg.
96
+ # Outputs a nicely formatted table or error message.
94
97
  def output_table(cmd, args, data)
95
98
  case data
96
99
  when Gitlab::ObjectifiedHash, Gitlab::FileResponse
97
100
  puts record_table([data], cmd, args)
98
101
  when Gitlab::PaginatedResponse
99
102
  puts record_table(data, cmd, args)
100
- else # probably just an error msg
103
+ else # probably just an error message
101
104
  puts data
102
105
  end
103
106
  end
@@ -108,7 +111,7 @@ class Gitlab::CLI
108
111
  else
109
112
  hash_result = case data
110
113
  when Gitlab::ObjectifiedHash, Gitlab::FileResponse
111
- record_hash([data], cmd, args, true)
114
+ record_hash([data], cmd, args, single_value: true)
112
115
  when Gitlab::PaginatedResponse
113
116
  record_hash(data, cmd, args)
114
117
  else
@@ -159,7 +162,7 @@ class Gitlab::CLI
159
162
  # @param [Array] args Options passed to the API call
160
163
  # @param [bool] single_value If set to true, a single result should be returned
161
164
  # @return [Hash] Result hash
162
- def record_hash(data, cmd, args, single_value=false)
165
+ def record_hash(data, cmd, args, single_value: false)
163
166
  if data.empty?
164
167
  result = nil
165
168
  else
@@ -169,21 +172,21 @@ class Gitlab::CLI
169
172
  row = {}
170
173
 
171
174
  keys.each do |key|
172
- case hash[key]
173
- when Hash
174
- row[key] = 'Hash'
175
- when StringIO
176
- row[key] = Base64.encode64(hash[key].read)
177
- when nil
178
- row[key] = nil
179
- else
180
- row[key] = hash[key]
181
- end
175
+ row[key] = case hash[key]
176
+ when Hash
177
+ 'Hash'
178
+ when StringIO
179
+ Base64.encode64(hash[key].read)
180
+ when nil
181
+ nil
182
+ else
183
+ hash[key]
184
+ end
182
185
  end
183
186
 
184
187
  result.push row
185
188
  end
186
- result = result[0] if single_value && result.count > 0
189
+ result = result[0] if single_value && result.count.positive?
187
190
  end
188
191
 
189
192
  {
@@ -202,36 +205,37 @@ class Gitlab::CLI
202
205
  end
203
206
 
204
207
  # Helper function to call Gitlab commands with args.
205
- def gitlab_helper(cmd, args=[])
206
- begin
207
- data = args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd)
208
- rescue => e
209
- puts e.message
210
- yield if block_given?
211
- end
212
-
213
- data
208
+ def gitlab_helper(cmd, args = [])
209
+ args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd)
210
+ rescue StandardError => e
211
+ puts e.message
212
+ yield if block_given?
214
213
  end
215
214
 
216
215
  # Convert a hash (recursively) to use symbol hash keys
217
216
  # @return [Hash]
218
217
  def symbolize_keys(hash)
219
218
  if hash.is_a?(Hash)
220
- hash = hash.each_with_object({}) do |(key, value), newhash|
221
- begin
222
- newhash[key.to_sym] = symbolize_keys(value)
223
- rescue NoMethodError
224
- raise "Error: cannot convert hash key to symbol: #{key}"
225
- end
219
+ hash = hash.each_with_object({}) do |(key, value), new_hash|
220
+ new_hash[key.to_sym] = symbolize_keys(value)
221
+ rescue NoMethodError
222
+ raise "Error: cannot convert hash key to symbol: #{key}"
226
223
  end
227
224
  end
228
225
 
229
226
  hash
230
227
  end
231
228
 
229
+ # Check if arg is a color in 6-digit hex notation with leading '#' sign
230
+ def hex_color?(arg)
231
+ pattern = /\A#\h{6}\Z/
232
+
233
+ pattern.match(arg)
234
+ end
235
+
232
236
  # YAML::load on a single argument
233
237
  def yaml_load(arg)
234
- YAML.safe_load(arg)
238
+ hex_color?(arg) ? arg : YAML.safe_load(arg)
235
239
  rescue Psych::SyntaxError
236
240
  raise "Error: Argument is not valid YAML syntax: #{arg}"
237
241
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to Award Emojis.
3
5
  # @see https://docs.gitlab.com/ce/api/access_requests.html
@@ -12,6 +14,7 @@ class Gitlab::Client
12
14
  def project_access_requests(project)
13
15
  get("/projects/#{url_encode project}/access_requests")
14
16
  end
17
+
15
18
  # Gets a list of access requests for a group viewable by the authenticated user.
16
19
  #
17
20
  # @example
@@ -22,6 +25,7 @@ class Gitlab::Client
22
25
  def group_access_requests(group)
23
26
  get("/groups/#{url_encode group}/access_requests")
24
27
  end
28
+
25
29
  # Requests access for the authenticated user to a project.
26
30
  #
27
31
  # @example
@@ -32,6 +36,7 @@ class Gitlab::Client
32
36
  def request_project_access(project)
33
37
  post("/projects/#{url_encode project}/access_requests")
34
38
  end
39
+
35
40
  # Requests access for the authenticated user to a group.
36
41
  #
37
42
  # @example
@@ -42,6 +47,7 @@ class Gitlab::Client
42
47
  def request_group_access(group)
43
48
  post("/groups/#{url_encode group}/access_requests")
44
49
  end
50
+
45
51
  # Approves a project access request for the given user.
46
52
  #
47
53
  # @example
@@ -55,6 +61,7 @@ class Gitlab::Client
55
61
  def approve_project_access_request(project, user_id, options = {})
56
62
  put("/projects/#{url_encode project}/access_requests/#{user_id}/approve", body: options)
57
63
  end
64
+
58
65
  # Approves a group access request for the given user.
59
66
  #
60
67
  # @example
@@ -68,6 +75,7 @@ class Gitlab::Client
68
75
  def approve_group_access_request(group, user_id, options = {})
69
76
  put("/groups/#{url_encode group}/access_requests/#{user_id}/approve", body: options)
70
77
  end
78
+
71
79
  # Denies a project access request for the given user.
72
80
  #
73
81
  # @example
@@ -79,6 +87,7 @@ class Gitlab::Client
79
87
  def deny_project_access_request(project, user_id)
80
88
  delete("/projects/#{url_encode project}/access_requests/#{user_id}")
81
89
  end
90
+
82
91
  # Denies a group access request for the given user.
83
92
  #
84
93
  # @example
@@ -91,4 +100,4 @@ class Gitlab::Client
91
100
  delete("/groups/#{url_encode group}/access_requests/#{user_id}")
92
101
  end
93
102
  end
94
- end
103
+ end
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to Award Emojis.
3
5
  # @see https://docs.gitlab.com/ce/api/award_emoji.html
@@ -79,7 +81,7 @@ class Gitlab::Client
79
81
  # @param [String] emoji_name The name of the emoji, without colons.
80
82
  # @return [Gitlab::ObjectifiedHash]
81
83
  def create_award_emoji(project, awardable_id, awardable_type, emoji_name)
82
- post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji", body: {name: emoji_name})
84
+ post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji", body: { name: emoji_name })
83
85
  end
84
86
 
85
87
  # Awards a new emoji to a note on an awardable(issue, merge request or snippet)
@@ -96,7 +98,7 @@ class Gitlab::Client
96
98
  # @param [String] emoji_name The name of the emoji, without colons.
97
99
  # @return [Gitlab::ObjectifiedHash]
98
100
  def create_note_award_emoji(project, awardable_id, awardable_type, note_id, emoji_name)
99
- post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji", body: {name: emoji_name})
101
+ post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji", body: { name: emoji_name })
100
102
  end
101
103
 
102
104
  # Deletes a single award emoji from an awardable(issue, merge request or snippet)
@@ -132,4 +134,4 @@ class Gitlab::Client
132
134
  delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
133
135
  end
134
136
  end
135
- end
137
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to issue boards.
3
5
  # @see https://docs.gitlab.com/ce/api/boards.html
@@ -13,10 +15,66 @@ class Gitlab::Client
13
15
  # @option options [Integer] :page The page number.
14
16
  # @option options [Integer] :per_page The number of results per page.
15
17
  # @return [Array<Gitlab::ObjectifiedHash>]
16
- def boards(project, options={})
18
+ def boards(project, options = {})
17
19
  get("/projects/#{url_encode project}/boards", query: options)
18
20
  end
19
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
+
20
78
  # Gets a board lists
21
79
  #
22
80
  # @example
@@ -28,6 +86,7 @@ class Gitlab::Client
28
86
  def board_lists(project, id)
29
87
  get("/projects/#{url_encode project}/boards/#{id}/lists")
30
88
  end
89
+
31
90
  #
32
91
  # Gets a single board list
33
92
  #
@@ -53,7 +112,7 @@ class Gitlab::Client
53
112
  # @param [Integer] label_id The ID of a label.
54
113
  # @return [Gitlab::ObjectifiedHash] Information about created list.
55
114
  def create_board_list(project, board_id, label_id)
56
- post("/projects/#{url_encode project}/boards/#{board_id}/lists", body: {label_id: label_id})
115
+ post("/projects/#{url_encode project}/boards/#{board_id}/lists", body: { label_id: label_id })
57
116
  end
58
117
 
59
118
  # Updates a board list.
@@ -67,7 +126,7 @@ class Gitlab::Client
67
126
  # @param [Integer] id The ID of a list.
68
127
  # @return [Gitlab::ObjectifiedHash] Information about updated board list.
69
128
  def edit_board_list(project, board_id, id, position)
70
- put("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}", body: {position: position})
129
+ put("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}", body: { position: position })
71
130
  end
72
131
 
73
132
  # Deletes a board list.
@@ -85,4 +144,3 @@ class Gitlab::Client
85
144
  end
86
145
  end
87
146
  end
88
-