gitlab 4.6.0 → 4.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gitlab/client/access_requests.rb +92 -90
  3. data/lib/gitlab/client/award_emojis.rb +126 -124
  4. data/lib/gitlab/client/boards.rb +81 -79
  5. data/lib/gitlab/client/branches.rb +89 -87
  6. data/lib/gitlab/client/build_variables.rb +117 -115
  7. data/lib/gitlab/client/builds.rb +98 -96
  8. data/lib/gitlab/client/commits.rb +154 -152
  9. data/lib/gitlab/client/deployments.rb +29 -27
  10. data/lib/gitlab/client/environments.rb +80 -78
  11. data/lib/gitlab/client/events.rb +54 -52
  12. data/lib/gitlab/client/group_milestones.rb +85 -83
  13. data/lib/gitlab/client/groups.rb +178 -176
  14. data/lib/gitlab/client/issues.rb +190 -188
  15. data/lib/gitlab/client/jobs.rb +150 -148
  16. data/lib/gitlab/client/keys.rb +14 -12
  17. data/lib/gitlab/client/labels.rb +79 -77
  18. data/lib/gitlab/client/merge_request_approvals.rb +101 -99
  19. data/lib/gitlab/client/merge_requests.rb +279 -277
  20. data/lib/gitlab/client/milestones.rb +85 -83
  21. data/lib/gitlab/client/namespaces.rb +18 -16
  22. data/lib/gitlab/client/notes.rb +260 -258
  23. data/lib/gitlab/client/pipeline_schedules.rb +123 -121
  24. data/lib/gitlab/client/pipeline_triggers.rb +93 -91
  25. data/lib/gitlab/client/pipelines.rb +62 -60
  26. data/lib/gitlab/client/projects.rb +526 -524
  27. data/lib/gitlab/client/repositories.rb +67 -65
  28. data/lib/gitlab/client/repository_files.rb +103 -101
  29. data/lib/gitlab/client/runners.rb +114 -112
  30. data/lib/gitlab/client/services.rb +45 -43
  31. data/lib/gitlab/client/sidekiq.rb +32 -30
  32. data/lib/gitlab/client/snippets.rb +86 -84
  33. data/lib/gitlab/client/system_hooks.rb +57 -55
  34. data/lib/gitlab/client/tags.rb +88 -86
  35. data/lib/gitlab/client/todos.rb +40 -38
  36. data/lib/gitlab/client/users.rb +243 -241
  37. data/lib/gitlab/client/versions.rb +13 -11
  38. data/lib/gitlab/help.rb +1 -1
  39. data/lib/gitlab/version.rb +1 -1
  40. metadata +1 -1
@@ -1,162 +1,164 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to projects.
4
- # @see https://docs.gitlab.com/ee/api/jobs.html
5
- module Jobs
6
- # Gets a list of Jobs for a Project
7
- #
8
- # @example
9
- # Gitlab.jobs(1)
10
- # Gitlab.jobs("project")
11
- #
12
- # @param [Integer, String] id The ID or name of a project.
13
- # @param [Hash] options A customizable set of options.
14
- # @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.
15
- # @return [Array<Gitlab::ObjectifiedHash>]
16
- def jobs(project_id, options = {})
17
- get("/projects/#{url_encode project_id}/jobs", query: options)
18
- end
3
+ class Gitlab::Client
4
+ # Defines methods related to projects.
5
+ # @see https://docs.gitlab.com/ee/api/jobs.html
6
+ module Jobs
7
+ # Gets a list of Jobs for a Project
8
+ #
9
+ # @example
10
+ # Gitlab.jobs(1)
11
+ # Gitlab.jobs("project")
12
+ #
13
+ # @param [Integer, String] id The ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @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.
16
+ # @return [Array<Gitlab::ObjectifiedHash>]
17
+ def jobs(project_id, options = {})
18
+ get("/projects/#{url_encode project_id}/jobs", query: options)
19
+ end
19
20
 
20
- # Gets a list of Jobs from a pipeline
21
- #
22
- # @example
23
- # Gitlab.pipeline_jobs(1, 2)
24
- # Gitlab.pipeline_jobs("project", 2)
25
- #
26
- # @param [Integer, String] The ID or name of a project.
27
- # @param [Integer] the id of the pipeline
28
- # @param [Hash] options A customizable set of options.
29
- # @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.
30
- # @return [Array<Gitlab::ObjectifiedHash>]
31
- def pipeline_jobs(project_id, pipeline_id, options = {})
32
- get("/projects/#{url_encode project_id}/pipelines/#{pipeline_id}/jobs", query: options)
33
- end
21
+ # Gets a list of Jobs from a pipeline
22
+ #
23
+ # @example
24
+ # Gitlab.pipeline_jobs(1, 2)
25
+ # Gitlab.pipeline_jobs("project", 2)
26
+ #
27
+ # @param [Integer, String] The ID or name of a project.
28
+ # @param [Integer] the id of the pipeline
29
+ # @param [Hash] options A customizable set of options.
30
+ # @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.
31
+ # @return [Array<Gitlab::ObjectifiedHash>]
32
+ def pipeline_jobs(project_id, pipeline_id, options = {})
33
+ get("/projects/#{url_encode project_id}/pipelines/#{pipeline_id}/jobs", query: options)
34
+ end
34
35
 
35
- # Gets a single job
36
- #
37
- # @example
38
- # Gitlab.job(1, 2)
39
- # Gitlab.job("project", 2)
40
- #
41
- # @param [Integer, String] The ID or name of a project.
42
- # @param [Integer] the id of the job
43
- def job(project_id, job_id)
44
- get("/projects/#{url_encode project_id}/jobs/#{job_id}")
45
- end
36
+ # Gets a single job
37
+ #
38
+ # @example
39
+ # Gitlab.job(1, 2)
40
+ # Gitlab.job("project", 2)
41
+ #
42
+ # @param [Integer, String] The ID or name of a project.
43
+ # @param [Integer] the id of the job
44
+ def job(project_id, job_id)
45
+ get("/projects/#{url_encode project_id}/jobs/#{job_id}")
46
+ end
46
47
 
47
- # Gets artifacts from a job
48
- #
49
- # @example
50
- # Gitlab.job_artifacts(1, 2)
51
- # Gitlab.job_artifacts("project", 2)
52
- #
53
- # @param [Integer, String] The ID or name of a project.
54
- # @param [Integer] the id of the job
55
- # @return [Array<Gitlab::ObjectifiedHash>]
56
- def job_artifacts(project_id, job_id)
57
- get("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts",
58
- format: nil,
59
- headers: { Accept: 'text/plain' },
60
- parser: ::Gitlab::Request::Parser)
61
- end
48
+ # Gets artifacts from a job
49
+ #
50
+ # @example
51
+ # Gitlab.job_artifacts(1, 2)
52
+ # Gitlab.job_artifacts("project", 2)
53
+ #
54
+ # @param [Integer, String] The ID or name of a project.
55
+ # @param [Integer] the id of the job
56
+ # @return [Array<Gitlab::ObjectifiedHash>]
57
+ def job_artifacts(project_id, job_id)
58
+ get("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts",
59
+ format: nil,
60
+ headers: { Accept: 'text/plain' },
61
+ parser: ::Gitlab::Request::Parser)
62
+ end
62
63
 
63
- # Download Job Artifact
64
- #
65
- # @example
66
- # Gitlab.job_artifacts_download(1, "master", "release")
67
- # Gitlab.job_artifacts_download("project", "master", "release")
68
- #
69
- # @param [Integer, String] id, The ID or name of a project.
70
- # @param [String] ref, Ref Name
71
- # @param [String] job, jobname
72
- # @return [Array<Gitlab::ObjectifiedHash>]
73
- def job_artifacts_download(project_id, ref_name, job_name)
74
- get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/download", query: { job: job_name },
75
- format: nil,
76
- headers: { Accept: 'text/plain' },
77
- parser: ::Gitlab::Request::Parser)
78
- end
64
+ # Download Job Artifact
65
+ #
66
+ # @example
67
+ # Gitlab.job_artifacts_download(1, "master", "release")
68
+ # Gitlab.job_artifacts_download("project", "master", "release")
69
+ #
70
+ # @param [Integer, String] id, The ID or name of a project.
71
+ # @param [String] ref, Ref Name
72
+ # @param [String] job, jobname
73
+ # @return [Array<Gitlab::ObjectifiedHash>]
74
+ def job_artifacts_download(project_id, ref_name, job_name)
75
+ get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/download", query: { job: job_name },
76
+ format: nil,
77
+ headers: { Accept: 'text/plain' },
78
+ parser: ::Gitlab::Request::Parser)
79
+ end
79
80
 
80
- # Get Job Trace
81
- #
82
- # @example
83
- # Gitlab.job_trace(1,1)
84
- # Gitlab.job_trace("project", 1)
85
- #
86
- # @param [Integer, String] The ID or name of a project.
87
- # @param [Integer] the id of the job
88
- # @return [Array<Gitlab::ObjectifiedHash>]
89
- def job_trace(project_id, job_id)
90
- get("/projects/#{url_encode project_id}/jobs/#{job_id}/trace",
91
- format: nil,
92
- headers: { Accept: 'text/plain' },
93
- parser: ::Gitlab::Request::Parser)
94
- end
81
+ # Get Job Trace
82
+ #
83
+ # @example
84
+ # Gitlab.job_trace(1,1)
85
+ # Gitlab.job_trace("project", 1)
86
+ #
87
+ # @param [Integer, String] The ID or name of a project.
88
+ # @param [Integer] the id of the job
89
+ # @return [Array<Gitlab::ObjectifiedHash>]
90
+ def job_trace(project_id, job_id)
91
+ get("/projects/#{url_encode project_id}/jobs/#{job_id}/trace",
92
+ format: nil,
93
+ headers: { Accept: 'text/plain' },
94
+ parser: ::Gitlab::Request::Parser)
95
+ end
95
96
 
96
- # Cancel a job
97
- #
98
- # @example
99
- # Gitlab.job_cancel(1,1)
100
- # Gitlab.job_cancel("project", 1)
101
- #
102
- # @param [Integer, String] The ID or name of a project.
103
- # @param [Integer] the id of the job
104
- # @return [Array<Gitlab::ObjectifiedHash>]
105
- def job_cancel(project_id, job_id)
106
- post("/projects/#{url_encode project_id}/jobs/#{job_id}/cancel")
107
- end
97
+ # Cancel a job
98
+ #
99
+ # @example
100
+ # Gitlab.job_cancel(1,1)
101
+ # Gitlab.job_cancel("project", 1)
102
+ #
103
+ # @param [Integer, String] The ID or name of a project.
104
+ # @param [Integer] the id of the job
105
+ # @return [Array<Gitlab::ObjectifiedHash>]
106
+ def job_cancel(project_id, job_id)
107
+ post("/projects/#{url_encode project_id}/jobs/#{job_id}/cancel")
108
+ end
108
109
 
109
- # Retry a job
110
- #
111
- # @example
112
- # Gitlab.job_retry(1,1)
113
- # Gitlab.job_retry("project", 1)
114
- #
115
- # @param [Integer, String] The ID or name of a project.
116
- # @param [Integer] the id of the job
117
- # @return [Array<Gitlab::ObjectifiedHash>]
118
- def job_retry(project_id, job_id)
119
- post("/projects/#{url_encode project_id}/jobs/#{job_id}/retry")
120
- end
110
+ # Retry a job
111
+ #
112
+ # @example
113
+ # Gitlab.job_retry(1,1)
114
+ # Gitlab.job_retry("project", 1)
115
+ #
116
+ # @param [Integer, String] The ID or name of a project.
117
+ # @param [Integer] the id of the job
118
+ # @return [Array<Gitlab::ObjectifiedHash>]
119
+ def job_retry(project_id, job_id)
120
+ post("/projects/#{url_encode project_id}/jobs/#{job_id}/retry")
121
+ end
121
122
 
122
- # Erase Job
123
- #
124
- # @example
125
- # Gitlab.job_erase(1,1)
126
- # Gitlab.job_erase("project", 1)
127
- #
128
- # @param [Integer, String] The ID or name of a project.
129
- # @param [Integer] the id of the job
130
- # @return [Array<Gitlab::ObjectifiedHash>]
131
- def job_erase(project_id, job_id)
132
- post("/projects/#{url_encode project_id}/jobs/#{job_id}/erase")
133
- end
123
+ # Erase Job
124
+ #
125
+ # @example
126
+ # Gitlab.job_erase(1,1)
127
+ # Gitlab.job_erase("project", 1)
128
+ #
129
+ # @param [Integer, String] The ID or name of a project.
130
+ # @param [Integer] the id of the job
131
+ # @return [Array<Gitlab::ObjectifiedHash>]
132
+ def job_erase(project_id, job_id)
133
+ post("/projects/#{url_encode project_id}/jobs/#{job_id}/erase")
134
+ end
134
135
 
135
- # Play a Job
136
- # Triggers a manual action to start a job.
137
- #
138
- # @example
139
- # Gitlab.job_play(1,1)
140
- # Gitlab.job_play("project", 1)
141
- #
142
- # @param [Integer, String] The ID or name of a project.
143
- # @param [Integer] the id of the job
144
- # @return [Array<Gitlab::ObjectifiedHash>]
145
- def job_play(project_id, job_id)
146
- post("/projects/#{url_encode project_id}/jobs/#{job_id}/play")
147
- end
136
+ # Play a Job
137
+ # Triggers a manual action to start a job.
138
+ #
139
+ # @example
140
+ # Gitlab.job_play(1,1)
141
+ # Gitlab.job_play("project", 1)
142
+ #
143
+ # @param [Integer, String] The ID or name of a project.
144
+ # @param [Integer] the id of the job
145
+ # @return [Array<Gitlab::ObjectifiedHash>]
146
+ def job_play(project_id, job_id)
147
+ post("/projects/#{url_encode project_id}/jobs/#{job_id}/play")
148
+ end
148
149
 
149
- # Keep Artifacts
150
- # Prevents artifacts from being deleted when expiration is set.
151
- #
152
- # @example
153
- # Gitlab.job_artifacts_keep(1,1)
154
- # Gitlab.job_artifacts_keep("project", 1)
155
- #
156
- # @param [Integer, String] The ID or name of a project.
157
- # @param [Integer] the id of the job
158
- # @return [Array<Gitlab::ObjectifiedHash>]
159
- def job_artifacts_keep(project_id, job_id)
160
- post("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/keep")
150
+ # Keep Artifacts
151
+ # Prevents artifacts from being deleted when expiration is set.
152
+ #
153
+ # @example
154
+ # Gitlab.job_artifacts_keep(1,1)
155
+ # Gitlab.job_artifacts_keep("project", 1)
156
+ #
157
+ # @param [Integer, String] The ID or name of a project.
158
+ # @param [Integer] the id of the job
159
+ # @return [Array<Gitlab::ObjectifiedHash>]
160
+ def job_artifacts_keep(project_id, job_id)
161
+ post("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/keep")
162
+ end
161
163
  end
162
164
  end
@@ -1,16 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to keys.
4
- # @see https://docs.gitlab.com/ce/api/keys.html
5
- module Keys
6
- # Gets information about a key.
7
- #
8
- # @example
9
- # Gitlab.key(1)
10
- #
11
- # @param [Integer] id The ID of a key.
12
- # @return [Gitlab::ObjectifiedHash]
13
- def key(id)
14
- get("/keys/#{id}")
3
+ class Gitlab::Client
4
+ # Defines methods related to keys.
5
+ # @see https://docs.gitlab.com/ce/api/keys.html
6
+ module Keys
7
+ # Gets information about a key.
8
+ #
9
+ # @example
10
+ # Gitlab.key(1)
11
+ #
12
+ # @param [Integer] id The ID of a key.
13
+ # @return [Gitlab::ObjectifiedHash]
14
+ def key(id)
15
+ get("/keys/#{id}")
16
+ end
15
17
  end
16
18
  end
@@ -1,86 +1,88 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to labels.
4
- # @see https://docs.gitlab.com/ce/api/labels.html
5
- module Labels
6
- # Gets a list of project's labels.
7
- #
8
- # @example
9
- # Gitlab.labels(5)
10
- #
11
- # @param [Integer, String] project The ID or name of a project.
12
- # @return [Array<Gitlab::ObjectifiedHash>]
13
- def labels(project, options = {})
14
- get("/projects/#{url_encode project}/labels", query: options)
15
- end
3
+ class Gitlab::Client
4
+ # Defines methods related to labels.
5
+ # @see https://docs.gitlab.com/ce/api/labels.html
6
+ module Labels
7
+ # Gets a list of project's labels.
8
+ #
9
+ # @example
10
+ # Gitlab.labels(5)
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @return [Array<Gitlab::ObjectifiedHash>]
14
+ def labels(project, options = {})
15
+ get("/projects/#{url_encode project}/labels", query: options)
16
+ end
16
17
 
17
- # Creates a new label.
18
- #
19
- # @example
20
- # Gitlab.create_label(42, "Backlog", '#DD10AA')
21
- #
22
- # @param [Integer, String] project The ID or name of a project.
23
- # @param [String] name The name of a label.
24
- # @param [String] color The color of a label.
25
- # @param [Hash] options A customizable set of options.
26
- # @option options [String] :description The description of the label.
27
- # @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority.
28
- # @return [Gitlab::ObjectifiedHash] Information about created label.
29
- def create_label(project, name, color, options = {})
30
- post("/projects/#{url_encode project}/labels", body: options.merge(name: name, color: color))
31
- end
18
+ # Creates a new label.
19
+ #
20
+ # @example
21
+ # Gitlab.create_label(42, "Backlog", '#DD10AA')
22
+ #
23
+ # @param [Integer, String] project The ID or name of a project.
24
+ # @param [String] name The name of a label.
25
+ # @param [String] color The color of a label.
26
+ # @param [Hash] options A customizable set of options.
27
+ # @option options [String] :description The description of the label.
28
+ # @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority.
29
+ # @return [Gitlab::ObjectifiedHash] Information about created label.
30
+ def create_label(project, name, color, options = {})
31
+ post("/projects/#{url_encode project}/labels", body: options.merge(name: name, color: color))
32
+ end
32
33
 
33
- # Updates a label.
34
- #
35
- # @example
36
- # Gitlab.edit_label(42, "Backlog", { new_name: 'TODO' })
37
- # Gitlab.edit_label(42, "Backlog", { new_name: 'TODO', color: '#DD10AA' })
38
- #
39
- # @param [Integer, String] project The ID or name of a project.
40
- # @param [String] name The name of a label.
41
- # @param [Hash] options A customizable set of options.
42
- # @option options [String] :new_name The new name of a label.
43
- # @option options [String] :color The color of a label.
44
- # @option options [String] :description The description of the label.
45
- # @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority.
46
- # @return [Gitlab::ObjectifiedHash] Information about updated label.
47
- def edit_label(project, name, options = {})
48
- put("/projects/#{url_encode project}/labels", body: options.merge(name: name))
49
- end
34
+ # Updates a label.
35
+ #
36
+ # @example
37
+ # Gitlab.edit_label(42, "Backlog", { new_name: 'TODO' })
38
+ # Gitlab.edit_label(42, "Backlog", { new_name: 'TODO', color: '#DD10AA' })
39
+ #
40
+ # @param [Integer, String] project The ID or name of a project.
41
+ # @param [String] name The name of a label.
42
+ # @param [Hash] options A customizable set of options.
43
+ # @option options [String] :new_name The new name of a label.
44
+ # @option options [String] :color The color of a label.
45
+ # @option options [String] :description The description of the label.
46
+ # @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority.
47
+ # @return [Gitlab::ObjectifiedHash] Information about updated label.
48
+ def edit_label(project, name, options = {})
49
+ put("/projects/#{url_encode project}/labels", body: options.merge(name: name))
50
+ end
50
51
 
51
- # Deletes a label.
52
- #
53
- # @example
54
- # Gitlab.delete_label(2, 'Backlog')
55
- #
56
- # @param [Integer, String] project The ID or name of a project.
57
- # @param [String] name The name of a label.
58
- # @return [Gitlab::ObjectifiedHash] Information about deleted label.
59
- def delete_label(project, name)
60
- delete("/projects/#{url_encode project}/labels", body: { name: name })
61
- end
52
+ # Deletes a label.
53
+ #
54
+ # @example
55
+ # Gitlab.delete_label(2, 'Backlog')
56
+ #
57
+ # @param [Integer, String] project The ID or name of a project.
58
+ # @param [String] name The name of a label.
59
+ # @return [Gitlab::ObjectifiedHash] Information about deleted label.
60
+ def delete_label(project, name)
61
+ delete("/projects/#{url_encode project}/labels", body: { name: name })
62
+ end
62
63
 
63
- # Subscribes the user to a label to receive notifications
64
- #
65
- # @example
66
- # Gitlab.subscribe_to_label(2, 'Backlog')
67
- #
68
- # @param [Integer, String] project The ID or name of a project.
69
- # @param [String] name The name of a label.
70
- # @return [Gitlab::ObjectifiedHash] Information about the label subscribed to.
71
- def subscribe_to_label(project, name)
72
- post("/projects/#{url_encode project}/labels/#{url_encode name}/subscribe")
73
- end
64
+ # Subscribes the user to a label to receive notifications
65
+ #
66
+ # @example
67
+ # Gitlab.subscribe_to_label(2, 'Backlog')
68
+ #
69
+ # @param [Integer, String] project The ID or name of a project.
70
+ # @param [String] name The name of a label.
71
+ # @return [Gitlab::ObjectifiedHash] Information about the label subscribed to.
72
+ def subscribe_to_label(project, name)
73
+ post("/projects/#{url_encode project}/labels/#{url_encode name}/subscribe")
74
+ end
74
75
 
75
- # Unsubscribes the user from a label to not receive notifications from it
76
- #
77
- # @example
78
- # Gitlab.unsubscribe_from_label(2, 'Backlog')
79
- #
80
- # @param [Integer, String] project The ID or name of a project.
81
- # @param [String] name The name of a label.
82
- # @return [Gitlab::ObjectifiedHash] Information about the label unsubscribed from.
83
- def unsubscribe_from_label(project, name)
84
- post("/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe")
76
+ # Unsubscribes the user from a label to not receive notifications from it
77
+ #
78
+ # @example
79
+ # Gitlab.unsubscribe_from_label(2, 'Backlog')
80
+ #
81
+ # @param [Integer, String] project The ID or name of a project.
82
+ # @param [String] name The name of a label.
83
+ # @return [Gitlab::ObjectifiedHash] Information about the label unsubscribed from.
84
+ def unsubscribe_from_label(project, name)
85
+ post("/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe")
86
+ end
85
87
  end
86
88
  end