gitlab 4.2.0 → 4.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +4 -2
  3. data/LICENSE.txt +1 -1
  4. data/README.md +96 -25
  5. data/exe/gitlab +5 -1
  6. data/lib/gitlab/api.rb +8 -3
  7. data/lib/gitlab/cli.rb +15 -15
  8. data/lib/gitlab/cli_helpers.rb +63 -61
  9. data/lib/gitlab/client/access_requests.rb +103 -0
  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 +53 -14
  15. data/lib/gitlab/client/broadcast_messages.rb +75 -0
  16. data/lib/gitlab/client/build_variables.rb +78 -9
  17. data/lib/gitlab/client/builds.rb +13 -11
  18. data/lib/gitlab/client/commits.rb +89 -19
  19. data/lib/gitlab/client/container_registry.rb +85 -0
  20. data/lib/gitlab/client/deployments.rb +34 -0
  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 +60 -0
  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 +94 -0
  30. data/lib/gitlab/client/groups.rb +197 -17
  31. data/lib/gitlab/client/issue_links.rb +48 -0
  32. data/lib/gitlab/client/issues.rb +98 -4
  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 +7 -5
  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 +265 -0
  39. data/lib/gitlab/client/merge_requests.rb +237 -9
  40. data/lib/gitlab/client/milestones.rb +19 -5
  41. data/lib/gitlab/client/namespaces.rb +4 -2
  42. data/lib/gitlab/client/notes.rb +58 -12
  43. data/lib/gitlab/client/pipeline_schedules.rb +147 -0
  44. data/lib/gitlab/client/pipeline_triggers.rb +12 -10
  45. data/lib/gitlab/client/pipelines.rb +40 -3
  46. data/lib/gitlab/client/project_badges.rb +85 -0
  47. data/lib/gitlab/client/project_clusters.rb +83 -0
  48. data/lib/gitlab/client/project_release_links.rb +76 -0
  49. data/lib/gitlab/client/project_releases.rb +79 -0
  50. data/lib/gitlab/client/projects.rb +280 -47
  51. data/lib/gitlab/client/protected_tags.rb +59 -0
  52. data/lib/gitlab/client/remote_mirrors.rb +51 -0
  53. data/lib/gitlab/client/repositories.rb +60 -6
  54. data/lib/gitlab/client/repository_files.rb +23 -5
  55. data/lib/gitlab/client/repository_submodules.rb +27 -0
  56. data/lib/gitlab/client/resource_label_events.rb +82 -0
  57. data/lib/gitlab/client/resource_state_events.rb +57 -0
  58. data/lib/gitlab/client/runners.rb +111 -15
  59. data/lib/gitlab/client/search.rb +66 -0
  60. data/lib/gitlab/client/services.rb +4 -1
  61. data/lib/gitlab/client/sidekiq.rb +39 -0
  62. data/lib/gitlab/client/snippets.rb +8 -4
  63. data/lib/gitlab/client/system_hooks.rb +9 -7
  64. data/lib/gitlab/client/tags.rb +15 -14
  65. data/lib/gitlab/client/templates.rb +100 -0
  66. data/lib/gitlab/client/todos.rb +7 -5
  67. data/lib/gitlab/client/user_snippets.rb +114 -0
  68. data/lib/gitlab/client/users.rb +166 -30
  69. data/lib/gitlab/client/versions.rb +18 -0
  70. data/lib/gitlab/client/wikis.rb +79 -0
  71. data/lib/gitlab/client.rb +49 -12
  72. data/lib/gitlab/configuration.rb +8 -6
  73. data/lib/gitlab/error.rb +74 -5
  74. data/lib/gitlab/file_response.rb +5 -3
  75. data/lib/gitlab/help.rb +19 -20
  76. data/lib/gitlab/objectified_hash.rb +27 -10
  77. data/lib/gitlab/page_links.rb +11 -9
  78. data/lib/gitlab/paginated_response.rb +37 -24
  79. data/lib/gitlab/request.rb +42 -53
  80. data/lib/gitlab/shell.rb +11 -12
  81. data/lib/gitlab/shell_history.rb +11 -13
  82. data/lib/gitlab/version.rb +3 -1
  83. data/lib/gitlab.rb +19 -8
  84. metadata +50 -395
  85. data/.gitignore +0 -22
  86. data/.travis.yml +0 -8
  87. data/CONTRIBUTING.md +0 -195
  88. data/Gemfile +0 -4
  89. data/Rakefile +0 -9
  90. data/bin/console +0 -10
  91. data/bin/setup +0 -6
  92. data/gitlab.gemspec +0 -31
  93. data/spec/fixtures/board_list.json +0 -1
  94. data/spec/fixtures/board_lists.json +0 -1
  95. data/spec/fixtures/boards.json +0 -1
  96. data/spec/fixtures/branch.json +0 -1
  97. data/spec/fixtures/branch_delete.json +0 -3
  98. data/spec/fixtures/branches.json +0 -1
  99. data/spec/fixtures/build.json +0 -38
  100. data/spec/fixtures/build_artifacts.json +0 -0
  101. data/spec/fixtures/build_cancel.json +0 -24
  102. data/spec/fixtures/build_erase.json +0 -24
  103. data/spec/fixtures/build_retry.json +0 -24
  104. data/spec/fixtures/builds.json +0 -78
  105. data/spec/fixtures/builds_commits.json +0 -64
  106. data/spec/fixtures/compare_merge_request_diff.json +0 -31
  107. data/spec/fixtures/empty.json +0 -0
  108. data/spec/fixtures/environment.json +0 -6
  109. data/spec/fixtures/environments.json +0 -14
  110. data/spec/fixtures/error_already_exists.json +0 -1
  111. data/spec/fixtures/error_project_not_found.json +0 -1
  112. data/spec/fixtures/get_repository_file.json +0 -1
  113. data/spec/fixtures/group.json +0 -60
  114. data/spec/fixtures/group_create.json +0 -1
  115. data/spec/fixtures/group_create_with_description.json +0 -1
  116. data/spec/fixtures/group_delete.json +0 -1
  117. data/spec/fixtures/group_member.json +0 -1
  118. data/spec/fixtures/group_member_delete.json +0 -1
  119. data/spec/fixtures/group_member_edit.json +0 -1
  120. data/spec/fixtures/group_members.json +0 -1
  121. data/spec/fixtures/group_projects.json +0 -44
  122. data/spec/fixtures/group_search.json +0 -2
  123. data/spec/fixtures/groups.json +0 -2
  124. data/spec/fixtures/issue.json +0 -1
  125. data/spec/fixtures/issue_award_emoji.json +0 -16
  126. data/spec/fixtures/issue_award_emojis.json +0 -34
  127. data/spec/fixtures/issues.json +0 -1
  128. data/spec/fixtures/job.json +0 -43
  129. data/spec/fixtures/job_trace.json +0 -1
  130. data/spec/fixtures/jobs.json +0 -91
  131. data/spec/fixtures/key.json +0 -1
  132. data/spec/fixtures/keys.json +0 -1
  133. data/spec/fixtures/label.json +0 -1
  134. data/spec/fixtures/label_unsubscribe.json +0 -1
  135. data/spec/fixtures/labels.json +0 -1
  136. data/spec/fixtures/merge_request.json +0 -1
  137. data/spec/fixtures/merge_request_award_emoji.json +0 -16
  138. data/spec/fixtures/merge_request_award_emojis.json +0 -34
  139. data/spec/fixtures/merge_request_changes.json +0 -1
  140. data/spec/fixtures/merge_request_closes_issues.json +0 -1
  141. data/spec/fixtures/merge_request_comment.json +0 -1
  142. data/spec/fixtures/merge_request_comments.json +0 -1
  143. data/spec/fixtures/merge_request_commits.json +0 -1
  144. data/spec/fixtures/merge_requests.json +0 -1
  145. data/spec/fixtures/milestone.json +0 -1
  146. data/spec/fixtures/milestone_issues.json +0 -1
  147. data/spec/fixtures/milestone_merge_requests.json +0 -1
  148. data/spec/fixtures/milestones.json +0 -1
  149. data/spec/fixtures/namespaces.json +0 -1
  150. data/spec/fixtures/note.json +0 -1
  151. data/spec/fixtures/note_award_emoji.json +0 -16
  152. data/spec/fixtures/note_award_emojis.json +0 -18
  153. data/spec/fixtures/notes.json +0 -1
  154. data/spec/fixtures/pipeline.json +0 -23
  155. data/spec/fixtures/pipeline_cancel.json +0 -23
  156. data/spec/fixtures/pipeline_create.json +0 -23
  157. data/spec/fixtures/pipeline_jobs.json +0 -91
  158. data/spec/fixtures/pipeline_retry.json +0 -23
  159. data/spec/fixtures/pipelines.json +0 -48
  160. data/spec/fixtures/project.json +0 -1
  161. data/spec/fixtures/project_commit.json +0 -13
  162. data/spec/fixtures/project_commit_comment.json +0 -1
  163. data/spec/fixtures/project_commit_comments.json +0 -1
  164. data/spec/fixtures/project_commit_create.json +0 -22
  165. data/spec/fixtures/project_commit_diff.json +0 -10
  166. data/spec/fixtures/project_commit_status.json +0 -42
  167. data/spec/fixtures/project_commits.json +0 -1
  168. data/spec/fixtures/project_edit.json +0 -21
  169. data/spec/fixtures/project_events.json +0 -1
  170. data/spec/fixtures/project_for_user.json +0 -1
  171. data/spec/fixtures/project_fork.json +0 -50
  172. data/spec/fixtures/project_fork_link.json +0 -1
  173. data/spec/fixtures/project_forked_for_user.json +0 -50
  174. data/spec/fixtures/project_hook.json +0 -1
  175. data/spec/fixtures/project_hooks.json +0 -1
  176. data/spec/fixtures/project_issues.json +0 -1
  177. data/spec/fixtures/project_key.json +0 -6
  178. data/spec/fixtures/project_keys.json +0 -6
  179. data/spec/fixtures/project_runner_enable.json +0 -7
  180. data/spec/fixtures/project_runners.json +0 -16
  181. data/spec/fixtures/project_search.json +0 -1
  182. data/spec/fixtures/project_star.json +0 -44
  183. data/spec/fixtures/project_tag_annotated.json +0 -1
  184. data/spec/fixtures/project_tag_lightweight.json +0 -1
  185. data/spec/fixtures/project_tags.json +0 -1
  186. data/spec/fixtures/project_unstar.json +0 -44
  187. data/spec/fixtures/project_update_commit_status.json +0 -20
  188. data/spec/fixtures/projects.json +0 -1
  189. data/spec/fixtures/push_rule.json +0 -1
  190. data/spec/fixtures/raw_file.json +0 -2
  191. data/spec/fixtures/release_create.json +0 -1
  192. data/spec/fixtures/release_update.json +0 -1
  193. data/spec/fixtures/repository_file.json +0 -1
  194. data/spec/fixtures/run_trigger.json +0 -1
  195. data/spec/fixtures/runner.json +0 -26
  196. data/spec/fixtures/runner_delete.json +0 -7
  197. data/spec/fixtures/runner_edit.json +0 -26
  198. data/spec/fixtures/runners.json +0 -16
  199. data/spec/fixtures/runners_all.json +0 -30
  200. data/spec/fixtures/service.json +0 -1
  201. data/spec/fixtures/session.json +0 -1
  202. data/spec/fixtures/shell_history.json +0 -2
  203. data/spec/fixtures/snippet.json +0 -1
  204. data/spec/fixtures/snippet_award_emoji.json +0 -16
  205. data/spec/fixtures/snippet_award_emojis.json +0 -34
  206. data/spec/fixtures/snippet_content.json +0 -3
  207. data/spec/fixtures/snippets.json +0 -1
  208. data/spec/fixtures/system_hook.json +0 -1
  209. data/spec/fixtures/system_hooks.json +0 -1
  210. data/spec/fixtures/tag.json +0 -1
  211. data/spec/fixtures/tag_create.json +0 -1
  212. data/spec/fixtures/tag_create_with_description.json +0 -1
  213. data/spec/fixtures/tag_delete.json +0 -1
  214. data/spec/fixtures/tags.json +0 -1
  215. data/spec/fixtures/team_member.json +0 -1
  216. data/spec/fixtures/team_members.json +0 -1
  217. data/spec/fixtures/todo.json +0 -73
  218. data/spec/fixtures/todos.json +0 -148
  219. data/spec/fixtures/tree.json +0 -1
  220. data/spec/fixtures/trigger.json +0 -10
  221. data/spec/fixtures/triggers.json +0 -12
  222. data/spec/fixtures/user.json +0 -1
  223. data/spec/fixtures/user_block_unblock.json +0 -1
  224. data/spec/fixtures/user_email.json +0 -1
  225. data/spec/fixtures/user_emails.json +0 -1
  226. data/spec/fixtures/user_search.json +0 -1
  227. data/spec/fixtures/users.json +0 -1
  228. data/spec/fixtures/variable.json +0 -4
  229. data/spec/fixtures/variables.json +0 -10
  230. data/spec/gitlab/cli_helpers_spec.rb +0 -57
  231. data/spec/gitlab/cli_spec.rb +0 -119
  232. data/spec/gitlab/client/award_emojis_spec.rb +0 -391
  233. data/spec/gitlab/client/boards_spec.rb +0 -94
  234. data/spec/gitlab/client/branches_spec.rb +0 -116
  235. data/spec/gitlab/client/build_variables_spec.rb +0 -86
  236. data/spec/gitlab/client/builds_spec.rb +0 -148
  237. data/spec/gitlab/client/client_spec.rb +0 -11
  238. data/spec/gitlab/client/commits_spec.rb +0 -168
  239. data/spec/gitlab/client/environments_spec.rb +0 -132
  240. data/spec/gitlab/client/groups_spec.rb +0 -195
  241. data/spec/gitlab/client/issues_spec.rb +0 -186
  242. data/spec/gitlab/client/jobs_spec.rb +0 -135
  243. data/spec/gitlab/client/keys_spec.rb +0 -19
  244. data/spec/gitlab/client/labels_spec.rb +0 -100
  245. data/spec/gitlab/client/merge_requests_spec.rb +0 -224
  246. data/spec/gitlab/client/milestones_spec.rb +0 -98
  247. data/spec/gitlab/client/namespaces_spec.rb +0 -22
  248. data/spec/gitlab/client/notes_spec.rb +0 -333
  249. data/spec/gitlab/client/pipeline_triggers_spec.rb +0 -157
  250. data/spec/gitlab/client/pipelines_spec.rb +0 -95
  251. data/spec/gitlab/client/projects_spec.rb +0 -613
  252. data/spec/gitlab/client/repositories_spec.rb +0 -94
  253. data/spec/gitlab/client/repository_files_spec.rb +0 -95
  254. data/spec/gitlab/client/runners_spec.rb +0 -185
  255. data/spec/gitlab/client/services_spec.rb +0 -55
  256. data/spec/gitlab/client/snippets_spec.rb +0 -100
  257. data/spec/gitlab/client/system_hooks_spec.rb +0 -69
  258. data/spec/gitlab/client/tags_spec.rb +0 -109
  259. data/spec/gitlab/client/todos_spec.rb +0 -45
  260. data/spec/gitlab/client/users_spec.rb +0 -418
  261. data/spec/gitlab/error_spec.rb +0 -45
  262. data/spec/gitlab/file_response_spec.rb +0 -33
  263. data/spec/gitlab/help_spec.rb +0 -46
  264. data/spec/gitlab/objectified_hash_spec.rb +0 -48
  265. data/spec/gitlab/page_links_spec.rb +0 -16
  266. data/spec/gitlab/paginated_response_spec.rb +0 -60
  267. data/spec/gitlab/request_spec.rb +0 -73
  268. data/spec/gitlab/shell_history_spec.rb +0 -53
  269. data/spec/gitlab/shell_spec.rb +0 -80
  270. data/spec/gitlab_spec.rb +0 -97
  271. data/spec/spec_helper.rb +0 -74
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to Award Emojis.
5
+ # @see https://docs.gitlab.com/ce/api/access_requests.html
6
+ module AccessRequests
7
+ # Gets a list of access requests for a project viewable by the authenticated user.
8
+ #
9
+ # @example
10
+ # Gitlab.project_access_requests(1)
11
+ #
12
+ # @param [Integer, String] :project(required) The ID or name of a project.
13
+ # @return [Array<Gitlab::ObjectifiedHash>] List of project access requests
14
+ def project_access_requests(project)
15
+ get("/projects/#{url_encode project}/access_requests")
16
+ end
17
+
18
+ # Gets a list of access requests for a group viewable by the authenticated user.
19
+ #
20
+ # @example
21
+ # Gitlab.group_access_requests(1)
22
+ #
23
+ # @param [Integer, String] :group(required) The ID or name of a group.
24
+ # @return [Array<Gitlab::ObjectifiedHash>] List of group access requests
25
+ def group_access_requests(group)
26
+ get("/groups/#{url_encode group}/access_requests")
27
+ end
28
+
29
+ # Requests access for the authenticated user to a project.
30
+ #
31
+ # @example
32
+ # Gitlab.request_project_access(1)
33
+ #
34
+ # @param [Integer, String] :project(required) The ID or name of a project.
35
+ # @return <Gitlab::ObjectifiedHash] Information about the requested project access
36
+ def request_project_access(project)
37
+ post("/projects/#{url_encode project}/access_requests")
38
+ end
39
+
40
+ # Requests access for the authenticated user to a group.
41
+ #
42
+ # @example
43
+ # Gitlab.request_group_access(1)
44
+ #
45
+ # @param [Integer, String] :group(required) The ID or name of a group.
46
+ # @return <Gitlab::ObjectifiedHash] Information about the requested group access
47
+ def request_group_access(group)
48
+ post("/groups/#{url_encode group}/access_requests")
49
+ end
50
+
51
+ # Approves a project access request for the given user.
52
+ #
53
+ # @example
54
+ # Gitlab.approve_project_access_request(1, 1)
55
+ # Gitlab.approve_project_access_request(1, 1, {access_level: '30'})
56
+ #
57
+ # @param [Integer, String] :project(required) The ID or name of a project.
58
+ # @param [Integer] :user_id(required) The user ID of the access requester
59
+ # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level)
60
+ # @return <Gitlab::ObjectifiedHash] Information about the approved project access request
61
+ def approve_project_access_request(project, user_id, options = {})
62
+ put("/projects/#{url_encode project}/access_requests/#{user_id}/approve", body: options)
63
+ end
64
+
65
+ # Approves a group access request for the given user.
66
+ #
67
+ # @example
68
+ # Gitlab.approve_group_access_request(1, 1)
69
+ # Gitlab.approve_group_access_request(1, 1, {access_level: '30'})
70
+ #
71
+ # @param [Integer, String] :group(required) The ID or name of a group.
72
+ # @param [Integer] :user_id(required) The user ID of the access requester
73
+ # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level)
74
+ # @return <Gitlab::ObjectifiedHash] Information about the approved group access request
75
+ def approve_group_access_request(group, user_id, options = {})
76
+ put("/groups/#{url_encode group}/access_requests/#{user_id}/approve", body: options)
77
+ end
78
+
79
+ # Denies a project access request for the given user.
80
+ #
81
+ # @example
82
+ # Gitlab.deny_project_access_request(1, 1)
83
+ #
84
+ # @param [Integer, String] :project(required) The ID or name of a project.
85
+ # @param [Integer] :user_id(required) The user ID of the access requester
86
+ # @return [void] This API call returns an empty response body.
87
+ def deny_project_access_request(project, user_id)
88
+ delete("/projects/#{url_encode project}/access_requests/#{user_id}")
89
+ end
90
+
91
+ # Denies a group access request for the given user.
92
+ #
93
+ # @example
94
+ # Gitlab.deny_group_access_request(1, 1)
95
+ #
96
+ # @param [Integer, String] :group(required) The ID or name of a group.
97
+ # @param [Integer] :user_id(required) The user ID of the access requester
98
+ # @return [void] This API call returns an empty response body.
99
+ def deny_group_access_request(group, user_id)
100
+ delete("/groups/#{url_encode group}/access_requests/#{user_id}")
101
+ end
102
+ 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
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to repositories.
3
5
  # @see https://docs.gitlab.com/ce/api/branches.html
@@ -12,10 +14,10 @@ class Gitlab::Client
12
14
  # @option options [Integer] :page The page number.
13
15
  # @option options [Integer] :per_page The number of results per page.
14
16
  # @return [Array<Gitlab::ObjectifiedHash>]
15
- def branches(project, options={})
17
+ def branches(project, options = {})
16
18
  get("/projects/#{url_encode project}/repository/branches", query: options)
17
19
  end
18
- alias_method :repo_branches, :branches
20
+ alias repo_branches branches
19
21
 
20
22
  # Gets information about a repository branch.
21
23
  #
@@ -27,9 +29,9 @@ class Gitlab::Client
27
29
  # @param [String] branch The name of the branch.
28
30
  # @return [Gitlab::ObjectifiedHash]
29
31
  def branch(project, branch)
30
- get("/projects/#{url_encode project}/repository/branches/#{branch}")
32
+ get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
31
33
  end
32
- alias_method :repo_branch, :branch
34
+ alias repo_branch branch
33
35
 
34
36
  # Protects a repository branch.
35
37
  #
@@ -47,9 +49,9 @@ class Gitlab::Client
47
49
  # @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false)
48
50
  # @return [Gitlab::ObjectifiedHash] Details about the branch
49
51
  def protect_branch(project, branch, options = {})
50
- put("/projects/#{url_encode project}/repository/branches/#{branch}/protect", body: options)
52
+ post("/projects/#{url_encode project}/protected_branches", body: { name: branch }.merge(options))
51
53
  end
52
- alias_method :repo_protect_branch, :protect_branch
54
+ alias repo_protect_branch protect_branch
53
55
 
54
56
  # Unprotects a repository branch.
55
57
  #
@@ -61,24 +63,24 @@ class Gitlab::Client
61
63
  # @param [String] branch The name of the branch.
62
64
  # @return [Gitlab::ObjectifiedHash] Details about the branch
63
65
  def unprotect_branch(project, branch)
64
- put("/projects/#{url_encode project}/repository/branches/#{branch}/unprotect")
66
+ delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
65
67
  end
66
- alias_method :repo_unprotect_branch, :unprotect_branch
68
+ alias repo_unprotect_branch unprotect_branch
67
69
 
68
70
  # Creates a repository branch. Requires Gitlab >= 6.8.x
69
71
  #
70
72
  # @example
71
- # Gitlab.create_branch(3, 'api')
72
- # Gitlab.repo_create_branch(5, 'master')
73
+ # Gitlab.create_branch(3, 'api', 'feat/new-api')
74
+ # Gitlab.repo_create_branch(5, 'master', 'develop')
73
75
  #
74
76
  # @param [Integer, String] project The ID or name of a project.
75
77
  # @param [String] branch The name of the new branch.
76
78
  # @param [String] ref Create branch from commit sha or existing branch
77
79
  # @return [Gitlab::ObjectifiedHash] Details about the branch
78
80
  def create_branch(project, branch, ref)
79
- post("/projects/#{url_encode project}/repository/branches", body: { branch: branch, ref: ref })
81
+ post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref })
80
82
  end
81
- alias_method :repo_create_branch, :create_branch
83
+ alias repo_create_branch create_branch
82
84
 
83
85
  # Deletes a repository branch. Requires Gitlab >= 6.8.x
84
86
  #
@@ -89,8 +91,45 @@ class Gitlab::Client
89
91
  # @param [Integer, String] project The ID or name of a project.
90
92
  # @param [String] branch The name of the branch to delete
91
93
  def delete_branch(project, branch)
92
- delete("/projects/#{url_encode project}/repository/branches/#{branch}")
94
+ delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
95
+ end
96
+ alias repo_delete_branch delete_branch
97
+
98
+ # Delete all branches that are merged into the project default branch. Protected branches will not be deleted as part of this operation.
99
+ #
100
+ # @example
101
+ # Gitlab.delete_merged_branches(3)
102
+ #
103
+ # @param [Integer, String] project The ID or name of a project.
104
+ # @return [nil] This API call returns an empty response body.
105
+ def delete_merged_branches(project)
106
+ delete("/projects/#{url_encode project}/repository/merged_branches")
107
+ end
108
+ alias repo_delete_merged_branches delete_merged_branches
109
+
110
+ # Gets a list of protected branches from a project.
111
+ #
112
+ # @example
113
+ # Gitlab.protected_branches(42)
114
+ #
115
+ # @param [Integer, String] project The ID or name of a project.
116
+ # @return [Array<Gitlab::ObjectifiedHash>]
117
+ def protected_branches(project)
118
+ get("/projects/#{url_encode project}/protected_branches")
119
+ end
120
+ alias repo_protected_branches protected_branches
121
+
122
+ # Gets a single protected branch or wildcard protected branch
123
+ #
124
+ # @example
125
+ # Gitlab.protected_branch(3, 'api')
126
+ #
127
+ # @param [Integer, String] project The ID or name of a project.
128
+ # @param [String] name The name of the branch or wildcard
129
+ # @return [Gitlab::ObjectifiedHash]
130
+ def protected_branch(project, branch)
131
+ get("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
93
132
  end
94
- alias_method :repo_delete_branch, :delete_branch
133
+ alias repo_protected_branch protected_branch
95
134
  end
96
135
  end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to broadcast messages (only accessible to administrators).
5
+ # @see https://docs.gitlab.com/ce/api/broadcast_messages.html
6
+ module BroadcastMessages
7
+ # Get all broadcast messages
8
+ #
9
+ # @example
10
+ # Gitlab.broadcast_messages
11
+ #
12
+ # @return [Array<Gitlab::ObjectifiedHash>]
13
+ def broadcast_messages
14
+ get('/broadcast_messages')
15
+ end
16
+
17
+ # Get a specific broadcast message
18
+ #
19
+ # @example
20
+ # Gitlab.broadcast_message(3)
21
+ #
22
+ # @param [Integer] id The ID of broadcast message
23
+ # @return [Gitlab::ObjectifiedHash]
24
+ def broadcast_message(id)
25
+ get("/broadcast_messages/#{id}")
26
+ end
27
+
28
+ # Create a broadcast message.
29
+ #
30
+ # @example
31
+ # Gitlab.create_broadcast_message('Mayday')
32
+ # Gitlab.create_broadcast_message('Mayday', {starts_at: Time.zone.now, ends_at: Time.zone.now + 30.minutes, color: '#cecece', font: '#FFFFFF'})
33
+ #
34
+ # @param [String] message Message to display
35
+ # @param [Hash] options A customizable set of options.
36
+ # @option options [DateTime] :starts_at(optional) Starting time (defaults to current time)
37
+ # @option options [DateTime] :ends_at(optional) Ending time (defaults to one hour from current time)
38
+ # @option options [String] :color(optional) Background color hex code
39
+ # @option options [String] :font(optional) Foreground color hex code
40
+ # @return [Gitlab::ObjectifiedHash] Information about created broadcast message.
41
+ def create_broadcast_message(message, options = {})
42
+ body = { message: message }.merge(options)
43
+ post('/broadcast_messages', body: body)
44
+ end
45
+
46
+ # Update a broadcast message
47
+ #
48
+ # @example
49
+ # Gitlab.edit_broadcast_message(6, { message: 'No Mayday' })
50
+ # Gitlab.edit_broadcast_message(6, { font: '#FEFEFE' })
51
+ #
52
+ # @param [Integer] id The ID of a broadcast message
53
+ # @param [Hash] options A customizable set of options.
54
+ # @option options [String] :message(optional) Message to display
55
+ # @option options [DateTime] :starts_at(optional) Starting time (defaults to current time)
56
+ # @option options [DateTime] :ends_at(optional) Ending time (defaults to one hour from current time)
57
+ # @option options [String] :color(optional) Background color hex code
58
+ # @option options [String] :font(optional) Foreground color hex code
59
+ # @return [Gitlab::ObjectifiedHash] Information about updated broadcast message.
60
+ def edit_broadcast_message(id, options = {})
61
+ put("/broadcast_messages/#{id}", body: options)
62
+ end
63
+
64
+ # Delete a broadcast message.
65
+ #
66
+ # @example
67
+ # Gitlab.delete_broadcast_message(3)
68
+ #
69
+ # @param [Integer] id The ID of a broadcast message.
70
+ # @return [nil] This API call returns an empty response body.
71
+ def delete_broadcast_message(id)
72
+ delete("/broadcast_messages/#{id}")
73
+ end
74
+ end
75
+ end