gitlab 4.7.0 → 4.8.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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +2 -0
- data/lib/gitlab/client.rb +6 -0
- data/lib/gitlab/client/branches.rb +37 -0
- data/lib/gitlab/client/broadcast_messages.rb +75 -0
- data/lib/gitlab/client/jobs.rb +3 -0
- data/lib/gitlab/client/milestones.rb +12 -0
- data/lib/gitlab/client/project_badges.rb +85 -0
- data/lib/gitlab/client/projects.rb +32 -0
- data/lib/gitlab/client/protected_tags.rb +59 -0
- data/lib/gitlab/client/repository_submodules.rb +27 -0
- data/lib/gitlab/client/templates.rb +100 -0
- data/lib/gitlab/client/wikis.rb +79 -0
- data/lib/gitlab/version.rb +1 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fef48a733afd37fc66b1b532365e9ec319f9c851be914a9f98396d02f185a90e
|
4
|
+
data.tar.gz: 6c11890061b7f83d161b9d3e18432192e01900c2edde6ce9124db5e9e0d2671f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8feed2cfadd99b265276e07b3aa16a0b32b2cf51fb79f00fa290b044c993c812148cdd563bea0524edc32c42e3693bb293129a8b1589e429880e7e46825f67d7
|
7
|
+
data.tar.gz: 7b2219621584d7ecb2ad3c6359adaab056c7d63b1c9a8cd805cd79eb3e39c2a353ddf762c5e55907e958b76b90fc5515463ae77275a7e87e181dd39d2ce688c8
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -65,6 +65,8 @@ Gitlab.private_token = 'qEsq1pt6HJPaNciie3MG'
|
|
65
65
|
Gitlab.http_proxy('proxyhost', 8888)
|
66
66
|
# proxy server with basic auth
|
67
67
|
Gitlab.http_proxy('proxyhost', 8888, 'proxyuser', 'strongpasswordhere')
|
68
|
+
# set timeout for responses
|
69
|
+
ENV['GITLAB_API_HTTPARTY_OPTIONS'] = '{read_timeout: 60}'
|
68
70
|
|
69
71
|
# list projects
|
70
72
|
Gitlab.projects(per_page: 5)
|
data/lib/gitlab/client.rb
CHANGED
@@ -10,6 +10,7 @@ module Gitlab
|
|
10
10
|
include AwardEmojis
|
11
11
|
include Boards
|
12
12
|
include Branches
|
13
|
+
include BroadcastMessages
|
13
14
|
include BuildVariables
|
14
15
|
include Builds
|
15
16
|
include Commits
|
@@ -30,18 +31,23 @@ module Gitlab
|
|
30
31
|
include PipelineSchedules
|
31
32
|
include PipelineTriggers
|
32
33
|
include Pipelines
|
34
|
+
include ProjectBadges
|
33
35
|
include Projects
|
36
|
+
include ProtectedTags
|
34
37
|
include Repositories
|
35
38
|
include RepositoryFiles
|
39
|
+
include RepositorySubmodules
|
36
40
|
include Runners
|
37
41
|
include Services
|
38
42
|
include Sidekiq
|
39
43
|
include Snippets
|
40
44
|
include SystemHooks
|
41
45
|
include Tags
|
46
|
+
include Templates
|
42
47
|
include Todos
|
43
48
|
include Users
|
44
49
|
include Versions
|
50
|
+
include Wikis
|
45
51
|
|
46
52
|
# Text representation of the client, masking private token.
|
47
53
|
#
|
@@ -94,5 +94,42 @@ class Gitlab::Client
|
|
94
94
|
delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
|
95
95
|
end
|
96
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}")
|
132
|
+
end
|
133
|
+
alias repo_protected_branch protected_branch
|
97
134
|
end
|
98
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
|
data/lib/gitlab/client/jobs.rb
CHANGED
@@ -9,10 +9,13 @@ class Gitlab::Client
|
|
9
9
|
# @example
|
10
10
|
# Gitlab.jobs(1)
|
11
11
|
# Gitlab.jobs("project")
|
12
|
+
# Gitlab.jobs("project", {scope: ["manual", "success"], per_page: 100 })
|
12
13
|
#
|
13
14
|
# @param [Integer, String] id The ID or name of a project.
|
14
15
|
# @param [Hash] options A customizable set of options.
|
15
16
|
# @option options [Array] :scope The scope of jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all jobs if none provided.
|
17
|
+
# @option options [Integer] :page The page number.
|
18
|
+
# @option options [Integer] :per_page The number of results per page.
|
16
19
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
20
|
def jobs(project_id, options = {})
|
18
21
|
get("/projects/#{url_encode project_id}/jobs", query: options)
|
@@ -90,5 +90,17 @@ class Gitlab::Client
|
|
90
90
|
def edit_milestone(project, id, options = {})
|
91
91
|
put("/projects/#{url_encode project}/milestones/#{id}", body: options)
|
92
92
|
end
|
93
|
+
|
94
|
+
# Delete a project milestone.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
# Gitlab.delete_milestone(5, 2)
|
98
|
+
#
|
99
|
+
# @param [Integer, String] project The ID or name of a project.
|
100
|
+
# @param [Integer] id The ID of a milestone.
|
101
|
+
# @return [nil] This API call returns an empty response body.
|
102
|
+
def delete_milestone(project, id)
|
103
|
+
delete("/projects/#{url_encode project}/milestones/#{id}")
|
104
|
+
end
|
93
105
|
end
|
94
106
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to project badges.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/project_badges.html
|
6
|
+
module ProjectBadges
|
7
|
+
# Gets a list of a projects badges and its group badges.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.project_badges(5)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of all badges of a project
|
14
|
+
def project_badges(project)
|
15
|
+
get("/projects/#{url_encode project}/badges")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gets a badge of a project.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Gitlab.project_badge(5, 42)
|
22
|
+
#
|
23
|
+
# @param [Integer, String] project The ID or name of a project.
|
24
|
+
# @param [Integer] badge_id The badge ID.
|
25
|
+
# @return [Gitlab::ObjectifiedHash] Information about the requested badge
|
26
|
+
def project_badge(project, badge_id)
|
27
|
+
get("/projects/#{url_encode project}/badges/#{badge_id}")
|
28
|
+
end
|
29
|
+
|
30
|
+
# Adds a badge to a project.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# Gitlab.add_project_badge(5, { link_url: 'https://abc.com/gitlab/gitlab-ce/commits/master', image_url: 'https://shields.io/my/badge1' })
|
34
|
+
#
|
35
|
+
# @param [Integer, String] project The ID or name of a project.
|
36
|
+
# @param [Hash] options A customizable set of options.
|
37
|
+
# @option options [String] :link_url(required) URL of the badge link
|
38
|
+
# @option options [String] :image_url(required) URL of the badge image
|
39
|
+
# @return [Gitlab::ObjectifiedHash] Information about the added project badge.
|
40
|
+
def add_project_badge(project, options = {})
|
41
|
+
post("/projects/#{url_encode project}/badges", body: options)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Updates a badge of a project..
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# Gitlab.edit_project_badge(5, 1, { link_url: 'https://abc.com/gitlab/gitlab-ce/commits/master', image_url: 'https://shields.io/my/badge1' })
|
48
|
+
#
|
49
|
+
# @param [Integer, String] project The ID or name of a project.
|
50
|
+
# @param [Integer] badge_id The badge ID.
|
51
|
+
# @param [Hash] options A customizable set of options.
|
52
|
+
# @option options [String] :link_url(optional) URL of the badge link
|
53
|
+
# @option options [String] :image_url(optional) URL of the badge image
|
54
|
+
# @return [Gitlab::ObjectifiedHash] Information about the updated project badge.
|
55
|
+
def edit_project_badge(project, badge_id, options = {})
|
56
|
+
put("/projects/#{url_encode project}/badges/#{badge_id}", body: options)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Removes a badge from a project. Only projects badges will be removed by using this endpoint.
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
# Gitlab.remove_project_badge(5, 42)
|
63
|
+
#
|
64
|
+
# @param [Integer, String] project The ID or name of a project.
|
65
|
+
# @param [Integer] badge_id The badge ID.
|
66
|
+
# @return [nil] This API call returns an empty response body.
|
67
|
+
def remove_project_badge(project, badge_id)
|
68
|
+
delete("/projects/#{url_encode project}/badges/#{badge_id}")
|
69
|
+
end
|
70
|
+
|
71
|
+
# Preview a badge from a project.
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# Gitlab.preview_project_badge(3, 'https://abc.com/gitlab/gitlab-ce/commits/master', 'https://shields.io/my/badge1')
|
75
|
+
#
|
76
|
+
# @param [Integer, String] project The ID or name of a project.
|
77
|
+
# @param [String] :link_url URL of the badge link
|
78
|
+
# @param [String] :image_url URL of the badge image
|
79
|
+
# @return [Gitlab::ObjectifiedHash] Returns how the link_url and image_url final URLs would be after resolving the placeholder interpolation.
|
80
|
+
def preview_project_badge(project, link_url, image_url)
|
81
|
+
query = { link_url: link_url, image_url: image_url }
|
82
|
+
get("/projects/#{url_encode project}/badges/render", query: query)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -538,5 +538,37 @@ class Gitlab::Client
|
|
538
538
|
def upload_file(id, file)
|
539
539
|
post("/projects/#{url_encode id}/uploads", body: { file: file })
|
540
540
|
end
|
541
|
+
|
542
|
+
# Get all project templates of a particular type
|
543
|
+
# @see https://docs.gitlab.com/ce/api/project_templates.html
|
544
|
+
#
|
545
|
+
# @example
|
546
|
+
# Gitlab.project_templates(1, 'dockerfiles')
|
547
|
+
# Gitlab.project_templates(1, 'licenses')
|
548
|
+
#
|
549
|
+
# @param [Integer, String] id The ID or URL-encoded path of the project.
|
550
|
+
# @param [String] type The type (dockerfiles|gitignores|gitlab_ci_ymls|licenses) of the template
|
551
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
552
|
+
def project_templates(project, type)
|
553
|
+
get("/projects/#{url_encode project}/templates/#{type}")
|
554
|
+
end
|
555
|
+
|
556
|
+
# Get one project template of a particular type
|
557
|
+
# @see https://docs.gitlab.com/ce/api/project_templates.html
|
558
|
+
#
|
559
|
+
# @example
|
560
|
+
# Gitlab.project_template(1, 'dockerfiles', 'dockey')
|
561
|
+
# Gitlab.project_template(1, 'licenses', 'gpl', { project: 'some project', fullname: 'Holder Holding' })
|
562
|
+
#
|
563
|
+
# @param [Integer, String] project The ID or URL-encoded path of the project.
|
564
|
+
# @param [String] type The type (dockerfiles|gitignores|gitlab_ci_ymls|licenses) of the template
|
565
|
+
# @param [String] key The key of the template, as obtained from the collection endpoint
|
566
|
+
# @param [Hash] options A customizable set of options.
|
567
|
+
# @option options [String] project(optional) The project name to use when expanding placeholders in the template. Only affects licenses
|
568
|
+
# @option options [String] fullname(optional) The full name of the copyright holder to use when expanding placeholders in the template. Only affects licenses
|
569
|
+
# @return [Gitlab::ObjectifiedHash]
|
570
|
+
def project_template(project, type, key, options = {})
|
571
|
+
get("/projects/#{url_encode project}/templates/#{type}/#{key}", query: options)
|
572
|
+
end
|
541
573
|
end
|
542
574
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to Protected Tags.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/protected_tags.html
|
6
|
+
module ProtectedTags
|
7
|
+
# Gets a list of protected tags from a project
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.protected_tags(1)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project(required) The ID or name of a project.
|
13
|
+
# @option options [Integer] :page The page number.
|
14
|
+
# @option options [Integer] :per_page The number of results per page.
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of all protected tags requested
|
16
|
+
def protected_tags(project, options = {})
|
17
|
+
get("/projects/#{url_encode project}/protected_tags", query: options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Gets a single protected tag or wildcard protected tag.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.protected_tag(1, 'release-1-0')
|
24
|
+
#
|
25
|
+
# @param [Integer, String] project(required) The ID or name of a project.
|
26
|
+
# @param [String] name(required) The name of the tag or wildcard
|
27
|
+
# @return <Gitlab::ObjectifiedHash] Information about the requested protected tag
|
28
|
+
def protected_tag(project, name)
|
29
|
+
get("/projects/#{url_encode project}/protected_tags/#{name}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# Protects a single repository tag or several project repository tags using a wildcard protected tag.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# Gitlab.protect_repository_tag(1, 'release-1-0')
|
36
|
+
# Gitlab.protect_repository_tag(1, 'release-1-0', create_access_level: 30)
|
37
|
+
#
|
38
|
+
# @param [Integer, String] project(required) The ID or name of a project.
|
39
|
+
# @param [String] name(required) The name of the tag or wildcard
|
40
|
+
# @option options [Integer] :create_access_level Access levels allowed to create (defaults: 40, maintainer access level)
|
41
|
+
# @return <Gitlab::ObjectifiedHash] Information about the protected repository tag
|
42
|
+
def protect_repository_tag(project, name, options = {})
|
43
|
+
body = { name: name }.merge(options)
|
44
|
+
post("/projects/#{url_encode project}/protected_tags", body: body)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Unprotects the given protected tag or wildcard protected tag.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# Gitlab.unprotect_repository_tag(1, 'release-1-0')
|
51
|
+
#
|
52
|
+
# @param [Integer, String] project(required) The ID or name of a project.
|
53
|
+
# @param [String] name(required) The name of the tag or wildcard
|
54
|
+
# @return [nil] This API call returns an empty response body.
|
55
|
+
def unprotect_repository_tag(project, name)
|
56
|
+
delete("/projects/#{url_encode project}/protected_tags/#{name}")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to repository submodules.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/repository_submodules.html
|
6
|
+
module RepositorySubmodules
|
7
|
+
# Edits an existing repository submodule.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.edit_file(42, "submodule", {
|
11
|
+
# branch: "branch",
|
12
|
+
# commit_sha: "3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88",
|
13
|
+
# commit_message: "commit message"
|
14
|
+
# })
|
15
|
+
#
|
16
|
+
# @param [Integer, String] project The ID or name of a project.
|
17
|
+
# @param [String] submodule full path of submodule to update.
|
18
|
+
# @param [Hash] options A customizable set of options.
|
19
|
+
# @param options [String] :branch the name of the branch to commit changes to.
|
20
|
+
# @param options [String] :commit_sha commit SHA to update the submodule to.
|
21
|
+
# @param options [String] :commit_message commit message text.
|
22
|
+
# @return [Gitlab::ObjectifiedHash]
|
23
|
+
def edit_submodule(project, submodule, options = {})
|
24
|
+
put("/projects/#{url_encode project}/repository/submodules/#{url_encode submodule}", body: options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to templates.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/templates/dockerfiles.html
|
6
|
+
# @see https://docs.gitlab.com/ce/api/templates/gitignores.html
|
7
|
+
# @see https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html
|
8
|
+
# @see https://docs.gitlab.com/ce/api/templates/licenses.html
|
9
|
+
module Templates
|
10
|
+
# Get all Dockerfile templates.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Gitlab.dockerfile_templates
|
14
|
+
#
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
|
+
def dockerfile_templates
|
17
|
+
get('/templates/dockerfiles')
|
18
|
+
end
|
19
|
+
|
20
|
+
# Get a single Dockerfile template.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.dockerfile_template('Binary')
|
24
|
+
#
|
25
|
+
# @param [String] key The key of the Dockerfile template
|
26
|
+
# @return [Gitlab::ObjectifiedHash]
|
27
|
+
def dockerfile_template(key)
|
28
|
+
get("/templates/dockerfiles/#{key}")
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get all gitignore templates.
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# Gitlab.gitignore_templates
|
35
|
+
#
|
36
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
37
|
+
def gitignore_templates
|
38
|
+
get('/templates/gitignores')
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get a single gitignore template.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# Gitlab.gitignore_template('Ruby')
|
45
|
+
#
|
46
|
+
# @param [String] key The key of the gitignore template
|
47
|
+
# @return [Gitlab::ObjectifiedHash]
|
48
|
+
def gitignore_template(key)
|
49
|
+
get("/templates/gitignores/#{key}")
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get all `gitlab_ci.yml` templates.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Gitlab.gitlab_ci_yml_templates
|
56
|
+
#
|
57
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
58
|
+
def gitlab_ci_yml_templates
|
59
|
+
get('/templates/gitlab_ci_ymls')
|
60
|
+
end
|
61
|
+
|
62
|
+
# Get a single `gitlab_ci.yml` template.
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
# Gitlab.gitlab_ci_yml_template('Ruby')
|
66
|
+
#
|
67
|
+
# @param [String] key The key of the gitlab_ci_yml template
|
68
|
+
# @return [Gitlab::ObjectifiedHash]
|
69
|
+
def gitlab_ci_yml_template(key)
|
70
|
+
get("/templates/gitlab_ci_ymls/#{key}")
|
71
|
+
end
|
72
|
+
|
73
|
+
# Get all license templates.
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
# Gitlab.license_templates
|
77
|
+
# Gitlab.license_templates(popular: true)
|
78
|
+
#
|
79
|
+
# @param [Hash] options A customizable set of options.
|
80
|
+
# @option options [Boolean] popular(optional) If passed, returns only popular licenses.
|
81
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
82
|
+
def license_templates(options = {})
|
83
|
+
get('/templates/licenses', query: options)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Get a single license template. You can pass parameters to replace the license placeholder.
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
# Gitlab.license_template('Ruby')
|
90
|
+
#
|
91
|
+
# @param [String] key The key of the license template
|
92
|
+
# @param [Hash] options A customizable set of options.
|
93
|
+
# @option options [String] project(optional) The copyrighted project name.
|
94
|
+
# @option options [String] fullname(optional) The full-name of the copyright holder
|
95
|
+
# @return [Gitlab::ObjectifiedHash]
|
96
|
+
def license_template(key, options = {})
|
97
|
+
get("/templates/licenses/#{key}", query: options)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to wikis.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/wikis.html
|
6
|
+
module Wikis
|
7
|
+
# Get all wiki pages for a given project.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.wikis(3)
|
11
|
+
# Gitlab.wikis(3, {with_content: 'Some wiki content'})
|
12
|
+
#
|
13
|
+
# @param [Integer, String] project The ID or name of a project.
|
14
|
+
# @param [Hash] options A customizable set of options.
|
15
|
+
# @option options [String] with_content(optional) Include pages content
|
16
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
|
+
def wikis(project, options = {})
|
18
|
+
get("/projects/#{url_encode project}/wikis", query: options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get a wiki page for a given project.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# Gitlab.wiki(3, 'home')
|
25
|
+
#
|
26
|
+
# @param [Integer, String] project The ID or name of a project.
|
27
|
+
# @param [String] slug The slug (a unique string) of the wiki page
|
28
|
+
# @return [Gitlab::ObjectifiedHash]
|
29
|
+
def wiki(project, slug)
|
30
|
+
get("/projects/#{url_encode project}/wikis/#{slug}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Creates a new wiki page for the given repository with the given title, slug, and content.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Gitlab.create_wiki(3, 'Some Title', 'Some Content')
|
37
|
+
# Gitlab.create_wiki(3, 'Some Title', 'Some Content', { format: 'rdoc' })
|
38
|
+
#
|
39
|
+
# @param [Integer, String] project The ID or name of a project.
|
40
|
+
# @param [String] content The content of the wiki page.
|
41
|
+
# @param [String] title The title of the wiki page.
|
42
|
+
# @param [Hash] options A customizable set of options.
|
43
|
+
# @option options [String] format (optional) The format of the wiki page. Available formats are: markdown (default), rdoc, and asciidoc.
|
44
|
+
# @return [Gitlab::ObjectifiedHash] Information about created wiki page.
|
45
|
+
def create_wiki(project, title, content, options = {})
|
46
|
+
body = { content: content, title: title }.merge(options)
|
47
|
+
post("/projects/#{url_encode project}/wikis", body: body)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Updates an existing wiki page. At least one parameter is required to update the wiki page.
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Gitlab.update_wiki(6, 'home', { title: 'New title' })
|
54
|
+
# Gitlab.update_wiki(6, 'home', { title: 'New title', content: 'New Message', format: 'rdoc' })
|
55
|
+
#
|
56
|
+
# @param [Integer, String] project The ID or name of a project.
|
57
|
+
# @param [String] slug The slug (a unique string) of the wiki page.
|
58
|
+
# @param [Hash] options A customizable set of options.
|
59
|
+
# @option options [String] content The content of the wiki page.
|
60
|
+
# @option options [String] title The title of the wiki page.
|
61
|
+
# @option options [String] format (optional) The format of the wiki page. Available formats are: markdown (default), rdoc, and asciidoc.
|
62
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated wiki page.
|
63
|
+
def update_wiki(project, slug, options = {})
|
64
|
+
put("/projects/#{url_encode project}/wikis/#{slug}", body: options)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Deletes a wiki page with a given slug.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Gitlab.delete_wiki(42, 'foo')
|
71
|
+
#
|
72
|
+
# @param [Integer, String] project The ID or name of a project.
|
73
|
+
# @param [String] slug The slug (a unique string) of the wiki page.
|
74
|
+
# @return [Gitlab::ObjectifiedHash] An empty objectified hash
|
75
|
+
def delete_wiki(project, slug)
|
76
|
+
delete("/projects/#{url_encode project}/wikis/#{slug}")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/gitlab/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nihad Abbasov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/gitlab/client/award_emojis.rb
|
141
141
|
- lib/gitlab/client/boards.rb
|
142
142
|
- lib/gitlab/client/branches.rb
|
143
|
+
- lib/gitlab/client/broadcast_messages.rb
|
143
144
|
- lib/gitlab/client/build_variables.rb
|
144
145
|
- lib/gitlab/client/builds.rb
|
145
146
|
- lib/gitlab/client/commits.rb
|
@@ -160,18 +161,23 @@ files:
|
|
160
161
|
- lib/gitlab/client/pipeline_schedules.rb
|
161
162
|
- lib/gitlab/client/pipeline_triggers.rb
|
162
163
|
- lib/gitlab/client/pipelines.rb
|
164
|
+
- lib/gitlab/client/project_badges.rb
|
163
165
|
- lib/gitlab/client/projects.rb
|
166
|
+
- lib/gitlab/client/protected_tags.rb
|
164
167
|
- lib/gitlab/client/repositories.rb
|
165
168
|
- lib/gitlab/client/repository_files.rb
|
169
|
+
- lib/gitlab/client/repository_submodules.rb
|
166
170
|
- lib/gitlab/client/runners.rb
|
167
171
|
- lib/gitlab/client/services.rb
|
168
172
|
- lib/gitlab/client/sidekiq.rb
|
169
173
|
- lib/gitlab/client/snippets.rb
|
170
174
|
- lib/gitlab/client/system_hooks.rb
|
171
175
|
- lib/gitlab/client/tags.rb
|
176
|
+
- lib/gitlab/client/templates.rb
|
172
177
|
- lib/gitlab/client/todos.rb
|
173
178
|
- lib/gitlab/client/users.rb
|
174
179
|
- lib/gitlab/client/versions.rb
|
180
|
+
- lib/gitlab/client/wikis.rb
|
175
181
|
- lib/gitlab/configuration.rb
|
176
182
|
- lib/gitlab/error.rb
|
177
183
|
- lib/gitlab/file_response.rb
|
@@ -202,8 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
208
|
- !ruby/object:Gem::Version
|
203
209
|
version: '0'
|
204
210
|
requirements: []
|
205
|
-
|
206
|
-
rubygems_version: 2.7.8
|
211
|
+
rubygems_version: 3.0.1
|
207
212
|
signing_key:
|
208
213
|
specification_version: 4
|
209
214
|
summary: A Ruby wrapper and CLI for the GitLab API
|