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,133 +1,135 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to pipeline schedules.
4
- # @see https://docs.gitlab.com/ce/api/pipeline_schedules.html
5
- module PipelineSchedules
6
- # Gets a list of project pipeline schedules.
7
- #
8
- # @example
9
- # Gitlab.pipeline_schedules(5)
10
- # Gitlab.pipeline_schedules(5, { scope: 'active' })
11
- #
12
- # @param [Integer, String] project the ID or name of a project.
13
- # @param [Hash] options A customizable set of options.
14
- # @options options [String] :scope The scope of pipeline schedules, one of a 'active' or 'inactive'.
15
- # @return [Array<Gitlab::ObjectifiedHash>]
16
- def pipeline_schedules(project, options = {})
17
- get("/projects/#{url_encode project}/pipeline_schedules", query: options)
18
- end
3
+ class Gitlab::Client
4
+ # Defines methods related to pipeline schedules.
5
+ # @see https://docs.gitlab.com/ce/api/pipeline_schedules.html
6
+ module PipelineSchedules
7
+ # Gets a list of project pipeline schedules.
8
+ #
9
+ # @example
10
+ # Gitlab.pipeline_schedules(5)
11
+ # Gitlab.pipeline_schedules(5, { scope: 'active' })
12
+ #
13
+ # @param [Integer, String] project the ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @options options [String] :scope The scope of pipeline schedules, one of a 'active' or 'inactive'.
16
+ # @return [Array<Gitlab::ObjectifiedHash>]
17
+ def pipeline_schedules(project, options = {})
18
+ get("/projects/#{url_encode project}/pipeline_schedules", query: options)
19
+ end
19
20
 
20
- # Gets a single pipeline schedule.
21
- #
22
- # @example
23
- # Gitlab.pipeline_schedule(5, 3)
24
- #
25
- # @param [Integer, String] project The ID or name of a project.
26
- # @param [Integer] id The ID of the pipeline schedule.
27
- # @return [Gitlab::ObjectifiedHash]
28
- def pipeline_schedule(project, id)
29
- get("/projects/#{url_encode project}/pipeline_schedules/#{id}")
30
- end
21
+ # Gets a single pipeline schedule.
22
+ #
23
+ # @example
24
+ # Gitlab.pipeline_schedule(5, 3)
25
+ #
26
+ # @param [Integer, String] project The ID or name of a project.
27
+ # @param [Integer] id The ID of the pipeline schedule.
28
+ # @return [Gitlab::ObjectifiedHash]
29
+ def pipeline_schedule(project, id)
30
+ get("/projects/#{url_encode project}/pipeline_schedules/#{id}")
31
+ end
31
32
 
32
- # Create a pipeline schedule.
33
- #
34
- # @example
35
- # Gitlab.create_pipeline_schedule(5, { description: 'example' })
36
- #
37
- # @param [Integer, String] project The ID or name of a project.
38
- # @param [Hash] options A customizable set of options.
39
- # @option options [String] :description The description of pipeline scehdule.
40
- # @option options [String] :ref The branch/tag name will be triggered.
41
- # @option options [String] :cron The cron (e.g. 0 1 * * *).
42
- # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC').
43
- # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
44
- # @return [Array<Gitlab::ObjectifiedHash>]
45
- def create_pipeline_schedule(project, options = {})
46
- post("/projects/#{url_encode project}/pipeline_schedules", query: options)
47
- end
33
+ # Create a pipeline schedule.
34
+ #
35
+ # @example
36
+ # Gitlab.create_pipeline_schedule(5, { description: 'example' })
37
+ #
38
+ # @param [Integer, String] project The ID or name of a project.
39
+ # @param [Hash] options A customizable set of options.
40
+ # @option options [String] :description The description of pipeline scehdule.
41
+ # @option options [String] :ref The branch/tag name will be triggered.
42
+ # @option options [String] :cron The cron (e.g. 0 1 * * *).
43
+ # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC').
44
+ # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
45
+ # @return [Array<Gitlab::ObjectifiedHash>]
46
+ def create_pipeline_schedule(project, options = {})
47
+ post("/projects/#{url_encode project}/pipeline_schedules", query: options)
48
+ end
48
49
 
49
- # Updates the pipeline schedule of a project.
50
- #
51
- # @example
52
- # Gitlab.edit_pipeline_schedule(3, 2, { description: 'example2' })
53
- #
54
- # @param [Integer, String] project The ID or name of a project.
55
- # @param [Integer] The pipeline schedule ID.
56
- # @param [Hash] options A customizable set of options.
57
- # @option options [String] :description The description of pipeline scehdule.
58
- # @option options [String] :ref The branch/tag name will be triggered.
59
- # @option options [String] :cron The cron (e.g. 0 1 * * *).
60
- # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC').
61
- # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
62
- # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule.
63
- def edit_pipeline_schedule(project, pipeline_schedule_id, options = {})
64
- put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", query: options)
65
- end
50
+ # Updates the pipeline schedule of a project.
51
+ #
52
+ # @example
53
+ # Gitlab.edit_pipeline_schedule(3, 2, { description: 'example2' })
54
+ #
55
+ # @param [Integer, String] project The ID or name of a project.
56
+ # @param [Integer] The pipeline schedule ID.
57
+ # @param [Hash] options A customizable set of options.
58
+ # @option options [String] :description The description of pipeline scehdule.
59
+ # @option options [String] :ref The branch/tag name will be triggered.
60
+ # @option options [String] :cron The cron (e.g. 0 1 * * *).
61
+ # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC').
62
+ # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
63
+ # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule.
64
+ def edit_pipeline_schedule(project, pipeline_schedule_id, options = {})
65
+ put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", query: options)
66
+ end
66
67
 
67
- # Take ownership of a pipeline schedule.
68
- #
69
- # @example
70
- # Gitlab.pipeline_schedule_take_ownership(5, 1)
71
- #
72
- # @param [Integer, String] project The ID or name of a project.
73
- # @param [Integer] trigger_id The pipeline schedule ID.
74
- # @return [Gitlab::ObjectifiedHash] The updated pipeline schedule.
75
- def pipeline_schedule_take_ownership(project, pipeline_schedule_id)
76
- post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership")
77
- end
68
+ # Take ownership of a pipeline schedule.
69
+ #
70
+ # @example
71
+ # Gitlab.pipeline_schedule_take_ownership(5, 1)
72
+ #
73
+ # @param [Integer, String] project The ID or name of a project.
74
+ # @param [Integer] trigger_id The pipeline schedule ID.
75
+ # @return [Gitlab::ObjectifiedHash] The updated pipeline schedule.
76
+ def pipeline_schedule_take_ownership(project, pipeline_schedule_id)
77
+ post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership")
78
+ end
78
79
 
79
- # Delete a pipeline schedule.
80
- #
81
- # @example
82
- # Gitlab.delete_pipeline_schedule(5, 1)
83
- #
84
- # @param [Integer, String] project The ID or name of a project.
85
- # @param [Integer] trigger_id The pipeline schedule ID.
86
- # @return [Gitlab::ObjectifiedHash] The deleted pipeline schedule.
87
- def delete_pipeline_schedule(project, pipeline_schedule_id)
88
- delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}")
89
- end
80
+ # Delete a pipeline schedule.
81
+ #
82
+ # @example
83
+ # Gitlab.delete_pipeline_schedule(5, 1)
84
+ #
85
+ # @param [Integer, String] project The ID or name of a project.
86
+ # @param [Integer] trigger_id The pipeline schedule ID.
87
+ # @return [Gitlab::ObjectifiedHash] The deleted pipeline schedule.
88
+ def delete_pipeline_schedule(project, pipeline_schedule_id)
89
+ delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}")
90
+ end
90
91
 
91
- # Create a pipeline schedule variable.
92
- #
93
- # @example
94
- # Gitlab.create_pipeline_schedule_variable(5, 1, { key: 'foo', value: 'bar' })
95
- #
96
- # @param [Integer, String] project The ID or name of a project.
97
- # @param [Integer] trigger_id The pipeline schedule ID.
98
- # @param [Hash] options A customizable set of options.
99
- # @option options [String] :key The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed.
100
- # @option options [String] :value The value of a variable
101
- # @return [Array<Gitlab::ObjectifiedHash>] The created pipeline schedule variable.
102
- def create_pipeline_schedule_variable(project, pipeline_schedule_id, options = {})
103
- post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", query: options)
104
- end
92
+ # Create a pipeline schedule variable.
93
+ #
94
+ # @example
95
+ # Gitlab.create_pipeline_schedule_variable(5, 1, { key: 'foo', value: 'bar' })
96
+ #
97
+ # @param [Integer, String] project The ID or name of a project.
98
+ # @param [Integer] trigger_id The pipeline schedule ID.
99
+ # @param [Hash] options A customizable set of options.
100
+ # @option options [String] :key The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed.
101
+ # @option options [String] :value The value of a variable
102
+ # @return [Array<Gitlab::ObjectifiedHash>] The created pipeline schedule variable.
103
+ def create_pipeline_schedule_variable(project, pipeline_schedule_id, options = {})
104
+ post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", query: options)
105
+ end
105
106
 
106
- # Updates the variable of a pipeline schedule.
107
- #
108
- # @example
109
- # Gitlab.edit_pipeline_schedule_variable(3, 2, "foo" { value: 'bar' })
110
- #
111
- # @param [Integer, String] project The ID or name of a project.
112
- # @param [Integer] The pipeline schedule ID.
113
- # @param [String] The key of a variable.
114
- # @param [Hash] options A customizable set of options.
115
- # @option options [String] :value The value of a variable.
116
- # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule variable.
117
- def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options = {})
118
- put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", query: options)
119
- end
107
+ # Updates the variable of a pipeline schedule.
108
+ #
109
+ # @example
110
+ # Gitlab.edit_pipeline_schedule_variable(3, 2, "foo" { value: 'bar' })
111
+ #
112
+ # @param [Integer, String] project The ID or name of a project.
113
+ # @param [Integer] The pipeline schedule ID.
114
+ # @param [String] The key of a variable.
115
+ # @param [Hash] options A customizable set of options.
116
+ # @option options [String] :value The value of a variable.
117
+ # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule variable.
118
+ def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options = {})
119
+ put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", query: options)
120
+ end
120
121
 
121
- # Delete the variable of a pipeline schedule
122
- #
123
- # @example
124
- # Gitlab.delete_pipeline_schedule_variable(3, 2, "foo")
125
- #
126
- # @param [Integer, String] project The ID or name of a project.
127
- # @param [Integer] The pipeline schedule ID.
128
- # @param [String] The key of a variable.
129
- # @return [Array<Gitlab::ObjectifiedHash>] The deleted pipeline schedule variable.
130
- def delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, _options = {})
131
- delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}")
122
+ # Delete the variable of a pipeline schedule
123
+ #
124
+ # @example
125
+ # Gitlab.delete_pipeline_schedule_variable(3, 2, "foo")
126
+ #
127
+ # @param [Integer, String] project The ID or name of a project.
128
+ # @param [Integer] The pipeline schedule ID.
129
+ # @param [String] The key of a variable.
130
+ # @return [Array<Gitlab::ObjectifiedHash>] The deleted pipeline schedule variable.
131
+ def delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, _options = {})
132
+ delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}")
133
+ end
132
134
  end
133
135
  end
@@ -1,101 +1,103 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to pipelines.
4
- # @see https://docs.gitlab.com/ce/api/pipeline_triggers.html
5
- # @see https://docs.gitlab.com/ce/ci/triggers/README.html
6
- module PipelineTriggers
7
- # Gets a list of the project's pipeline triggers
8
- #
9
- # @example
10
- # Gitlab.triggers(5)
11
- #
12
- # @param [Integer, String] project The ID or name of a project.
13
- # @return [Array<Gitlab::ObjectifiedHash>] The list of triggers.
14
- def triggers(project)
15
- get("/projects/#{url_encode project}/triggers")
16
- end
3
+ class Gitlab::Client
4
+ # Defines methods related to pipelines.
5
+ # @see https://docs.gitlab.com/ce/api/pipeline_triggers.html
6
+ # @see https://docs.gitlab.com/ce/ci/triggers/README.html
7
+ module PipelineTriggers
8
+ # Gets a list of the project's pipeline triggers
9
+ #
10
+ # @example
11
+ # Gitlab.triggers(5)
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @return [Array<Gitlab::ObjectifiedHash>] The list of triggers.
15
+ def triggers(project)
16
+ get("/projects/#{url_encode project}/triggers")
17
+ end
17
18
 
18
- # Gets details of project's pipeline trigger.
19
- #
20
- # @example
21
- # Gitlab.trigger(5, 1)
22
- #
23
- # @param [Integer, String] project The ID or name of a project.
24
- # @param [Integer] trigger_id The trigger ID.
25
- # @return [Gitlab::ObjectifiedHash] The trigger.
26
- def trigger(project, trigger_id)
27
- get("/projects/#{url_encode project}/triggers/#{trigger_id}")
28
- end
19
+ # Gets details of project's pipeline trigger.
20
+ #
21
+ # @example
22
+ # Gitlab.trigger(5, 1)
23
+ #
24
+ # @param [Integer, String] project The ID or name of a project.
25
+ # @param [Integer] trigger_id The trigger ID.
26
+ # @return [Gitlab::ObjectifiedHash] The trigger.
27
+ def trigger(project, trigger_id)
28
+ get("/projects/#{url_encode project}/triggers/#{trigger_id}")
29
+ end
29
30
 
30
- # Create a pipeline trigger for a project.
31
- #
32
- # @example
33
- # Gitlab.create_trigger(5, description: "my description")
34
- #
35
- # @param [Integer, String] project The ID or name of a project.
36
- # @param [String] description The trigger name
37
- # @return [Gitlab::ObjectifiedHash] The created trigger.
38
- def create_trigger(project, description)
39
- post("/projects/#{url_encode project}/triggers", body: { description: description })
40
- end
31
+ # Create a pipeline trigger for a project.
32
+ #
33
+ # @example
34
+ # Gitlab.create_trigger(5, description: "my description")
35
+ #
36
+ # @param [Integer, String] project The ID or name of a project.
37
+ # @param [String] description The trigger name
38
+ # @return [Gitlab::ObjectifiedHash] The created trigger.
39
+ def create_trigger(project, description)
40
+ post("/projects/#{url_encode project}/triggers", body: { description: description })
41
+ end
41
42
 
42
- # Update a project trigger
43
- #
44
- # @example
45
- # Gitlab.update_trigger(5, 1, description: "my description")
46
- #
47
- # @param [Integer, String] project The ID or name of a project.
48
- # @param [Integer] trigger_id The trigger ID.
49
- # @param [Hash] options A customizable set of options.
50
- # @option options [String] :description The trigger name.
51
- # @return [Gitlab::ObjectifiedHash] The updated trigger.
52
- def update_trigger(project, trigger_id, options = {})
53
- put("/projects/#{url_encode project}/triggers/#{trigger_id}", body: options)
54
- end
43
+ # Update a project trigger
44
+ #
45
+ # @example
46
+ # Gitlab.update_trigger(5, 1, description: "my description")
47
+ #
48
+ # @param [Integer, String] project The ID or name of a project.
49
+ # @param [Integer] trigger_id The trigger ID.
50
+ # @param [Hash] options A customizable set of options.
51
+ # @option options [String] :description The trigger name.
52
+ # @return [Gitlab::ObjectifiedHash] The updated trigger.
53
+ def update_trigger(project, trigger_id, options = {})
54
+ put("/projects/#{url_encode project}/triggers/#{trigger_id}", body: options)
55
+ end
55
56
 
56
- # Take ownership of a project trigger
57
- #
58
- # @example
59
- # Gitlab.trigger_take_ownership(5, 1)
60
- #
61
- # @param [Integer, String] project The ID or name of a project.
62
- # @param [Integer] trigger_id The trigger ID.
63
- # @return [Gitlab::ObjectifiedHash] The updated trigger.
64
- def trigger_take_ownership(project, trigger_id)
65
- post("/projects/#{url_encode project}/triggers/#{trigger_id}/take_ownership")
66
- end
57
+ # Take ownership of a project trigger
58
+ #
59
+ # @example
60
+ # Gitlab.trigger_take_ownership(5, 1)
61
+ #
62
+ # @param [Integer, String] project The ID or name of a project.
63
+ # @param [Integer] trigger_id The trigger ID.
64
+ # @return [Gitlab::ObjectifiedHash] The updated trigger.
65
+ def trigger_take_ownership(project, trigger_id)
66
+ post("/projects/#{url_encode project}/triggers/#{trigger_id}/take_ownership")
67
+ end
67
68
 
68
- # Remove a project's pipeline trigger.
69
- #
70
- # @example
71
- # Gitlab.remove_trigger(5, 1)
72
- #
73
- # @param [Integer, String] project The ID or name of a project.
74
- # @param [Integer] trigger_id The trigger ID.
75
- # @return [void] This API call returns an empty response body.
76
- def remove_trigger(project, trigger_id)
77
- delete("/projects/#{url_encode project}/triggers/#{trigger_id}")
78
- end
79
- alias delete_trigger remove_trigger
69
+ # Remove a project's pipeline trigger.
70
+ #
71
+ # @example
72
+ # Gitlab.remove_trigger(5, 1)
73
+ #
74
+ # @param [Integer, String] project The ID or name of a project.
75
+ # @param [Integer] trigger_id The trigger ID.
76
+ # @return [void] This API call returns an empty response body.
77
+ def remove_trigger(project, trigger_id)
78
+ delete("/projects/#{url_encode project}/triggers/#{trigger_id}")
79
+ end
80
+ alias delete_trigger remove_trigger
80
81
 
81
- # Run the given project pipeline trigger.
82
- #
83
- # @example
84
- # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master')
85
- # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" })
86
- #
87
- # @see https://docs.gitlab.com/ce/ci/triggers/README.html
88
- #
89
- # @param [Integer, String] project The ID or name of the project.
90
- # @param [String] token The token of a trigger.
91
- # @param [String] ref Branch or tag name to build.
92
- # @param [Hash] variables A set of build variables to use for the build. (optional)
93
- # @return [Gitlab::ObjectifiedHash] The trigger.
94
- def run_trigger(project, token, ref, variables = {})
95
- post("/projects/#{url_encode project}/trigger/pipeline", unauthenticated: true, body: {
96
- token: token,
97
- ref: ref,
98
- variables: variables
99
- })
82
+ # Run the given project pipeline trigger.
83
+ #
84
+ # @example
85
+ # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master')
86
+ # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" })
87
+ #
88
+ # @see https://docs.gitlab.com/ce/ci/triggers/README.html
89
+ #
90
+ # @param [Integer, String] project The ID or name of the project.
91
+ # @param [String] token The token of a trigger.
92
+ # @param [String] ref Branch or tag name to build.
93
+ # @param [Hash] variables A set of build variables to use for the build. (optional)
94
+ # @return [Gitlab::ObjectifiedHash] The trigger.
95
+ def run_trigger(project, token, ref, variables = {})
96
+ post("/projects/#{url_encode project}/trigger/pipeline", unauthenticated: true, body: {
97
+ token: token,
98
+ ref: ref,
99
+ variables: variables
100
+ })
101
+ end
100
102
  end
101
103
  end
@@ -1,68 +1,70 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to pipelines.
4
- # @see https://docs.gitlab.com/ce/api/pipelines.html
5
- module Pipelines
6
- # Gets a list of project pipelines.
7
- #
8
- # @example
9
- # Gitlab.pipelines(5)
10
- # Gitlab.pipelines(5, { per_page: 10, page: 2 })
11
- #
12
- # @param [Integer, String] project The ID or name of a project.
13
- # @param [Hash] options A customizable set of options.
14
- # @option options [Integer] :page The page number.
15
- # @option options [Integer] :per_page The number of results per page.
16
- # @return [Array<Gitlab::ObjectifiedHash>]
17
- def pipelines(project, options = {})
18
- get("/projects/#{url_encode project}/pipelines", query: options)
19
- end
3
+ class Gitlab::Client
4
+ # Defines methods related to pipelines.
5
+ # @see https://docs.gitlab.com/ce/api/pipelines.html
6
+ module Pipelines
7
+ # Gets a list of project pipelines.
8
+ #
9
+ # @example
10
+ # Gitlab.pipelines(5)
11
+ # Gitlab.pipelines(5, { per_page: 10, page: 2 })
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 [Integer] :page The page number.
16
+ # @option options [Integer] :per_page The number of results per page.
17
+ # @return [Array<Gitlab::ObjectifiedHash>]
18
+ def pipelines(project, options = {})
19
+ get("/projects/#{url_encode project}/pipelines", query: options)
20
+ end
20
21
 
21
- # Gets a single pipeline.
22
- #
23
- # @example
24
- # Gitlab.pipeline(5, 36)
25
- #
26
- # @param [Integer, String] project The ID or name of a project.
27
- # @param [Integer] id The ID of a pipeline.
28
- # @return [Gitlab::ObjectifiedHash]
29
- def pipeline(project, id)
30
- get("/projects/#{url_encode project}/pipelines/#{id}")
31
- end
22
+ # Gets a single pipeline.
23
+ #
24
+ # @example
25
+ # Gitlab.pipeline(5, 36)
26
+ #
27
+ # @param [Integer, String] project The ID or name of a project.
28
+ # @param [Integer] id The ID of a pipeline.
29
+ # @return [Gitlab::ObjectifiedHash]
30
+ def pipeline(project, id)
31
+ get("/projects/#{url_encode project}/pipelines/#{id}")
32
+ end
32
33
 
33
- # Create a pipeline.
34
- #
35
- # @example
36
- # Gitlab.create_pipeline(5, 'master')
37
- #
38
- # @param [Integer, String] project The ID or name of a project.
39
- # @param [String] ref Reference to commit.
40
- # @return [Gitlab::ObjectifiedHash] The pipelines changes.
41
- def create_pipeline(project, ref)
42
- post("/projects/#{url_encode project}/pipeline?ref=#{ref}")
43
- end
34
+ # Create a pipeline.
35
+ #
36
+ # @example
37
+ # Gitlab.create_pipeline(5, 'master')
38
+ #
39
+ # @param [Integer, String] project The ID or name of a project.
40
+ # @param [String] ref Reference to commit.
41
+ # @return [Gitlab::ObjectifiedHash] The pipelines changes.
42
+ def create_pipeline(project, ref)
43
+ post("/projects/#{url_encode project}/pipeline?ref=#{ref}")
44
+ end
44
45
 
45
- # Cancels a pipeline.
46
- #
47
- # @example
48
- # Gitlab.cancel_pipeline(5, 1)
49
- #
50
- # @param [Integer, String] project The ID or name of a project.
51
- # @param [Integer] id The ID of a pipeline.
52
- # @return [Gitlab::ObjectifiedHash] The pipelines changes.
53
- def cancel_pipeline(project, id)
54
- post("/projects/#{url_encode project}/pipelines/#{id}/cancel")
55
- end
46
+ # Cancels a pipeline.
47
+ #
48
+ # @example
49
+ # Gitlab.cancel_pipeline(5, 1)
50
+ #
51
+ # @param [Integer, String] project The ID or name of a project.
52
+ # @param [Integer] id The ID of a pipeline.
53
+ # @return [Gitlab::ObjectifiedHash] The pipelines changes.
54
+ def cancel_pipeline(project, id)
55
+ post("/projects/#{url_encode project}/pipelines/#{id}/cancel")
56
+ end
56
57
 
57
- # Retry a pipeline.
58
- #
59
- # @example
60
- # Gitlab.retry_pipeline(5, 1)
61
- #
62
- # @param [Integer, String] project The ID or name of a project.
63
- # @param [Integer] id The ID of a pipeline.
64
- # @return [Array<Gitlab::ObjectifiedHash>] The pipelines changes.
65
- def retry_pipeline(project, id)
66
- post("/projects/#{url_encode project}/pipelines/#{id}/retry")
58
+ # Retry a pipeline.
59
+ #
60
+ # @example
61
+ # Gitlab.retry_pipeline(5, 1)
62
+ #
63
+ # @param [Integer, String] project The ID or name of a project.
64
+ # @param [Integer] id The ID of a pipeline.
65
+ # @return [Array<Gitlab::ObjectifiedHash>] The pipelines changes.
66
+ def retry_pipeline(project, id)
67
+ post("/projects/#{url_encode project}/pipelines/#{id}/retry")
68
+ end
67
69
  end
68
70
  end