gitlab 4.5.0 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/stale.yml +18 -0
  3. data/.rubocop_todo.yml +46 -0
  4. data/Gemfile +2 -0
  5. data/README.md +22 -22
  6. data/Rakefile +3 -5
  7. data/bin/console +1 -0
  8. data/exe/gitlab +5 -1
  9. data/gitlab.gemspec +9 -6
  10. data/lib/gitlab.rb +6 -3
  11. data/lib/gitlab/api.rb +5 -3
  12. data/lib/gitlab/cli.rb +11 -5
  13. data/lib/gitlab/cli_helpers.rb +31 -22
  14. data/lib/gitlab/client.rb +7 -8
  15. data/lib/gitlab/client/access_requests.rb +100 -93
  16. data/lib/gitlab/client/award_emojis.rb +127 -127
  17. data/lib/gitlab/client/boards.rb +82 -82
  18. data/lib/gitlab/client/branches.rb +89 -89
  19. data/lib/gitlab/client/build_variables.rb +117 -117
  20. data/lib/gitlab/client/builds.rb +98 -98
  21. data/lib/gitlab/client/commits.rb +154 -154
  22. data/lib/gitlab/client/deployments.rb +29 -29
  23. data/lib/gitlab/client/environments.rb +80 -80
  24. data/lib/gitlab/client/events.rb +54 -54
  25. data/lib/gitlab/client/group_milestones.rb +85 -86
  26. data/lib/gitlab/client/groups.rb +178 -178
  27. data/lib/gitlab/client/issues.rb +195 -196
  28. data/lib/gitlab/client/jobs.rb +150 -150
  29. data/lib/gitlab/client/keys.rb +14 -14
  30. data/lib/gitlab/client/labels.rb +79 -79
  31. data/lib/gitlab/client/merge_request_approvals.rb +102 -102
  32. data/lib/gitlab/client/merge_requests.rb +281 -256
  33. data/lib/gitlab/client/milestones.rb +85 -85
  34. data/lib/gitlab/client/namespaces.rb +18 -18
  35. data/lib/gitlab/client/notes.rb +260 -260
  36. data/lib/gitlab/client/pipeline_schedules.rb +123 -123
  37. data/lib/gitlab/client/pipeline_triggers.rb +93 -93
  38. data/lib/gitlab/client/pipelines.rb +62 -62
  39. data/lib/gitlab/client/projects.rb +526 -505
  40. data/lib/gitlab/client/repositories.rb +68 -55
  41. data/lib/gitlab/client/repository_files.rb +103 -103
  42. data/lib/gitlab/client/runners.rb +113 -115
  43. data/lib/gitlab/client/services.rb +46 -45
  44. data/lib/gitlab/client/sidekiq.rb +32 -32
  45. data/lib/gitlab/client/snippets.rb +86 -86
  46. data/lib/gitlab/client/system_hooks.rb +57 -57
  47. data/lib/gitlab/client/tags.rb +87 -88
  48. data/lib/gitlab/client/todos.rb +41 -41
  49. data/lib/gitlab/client/users.rb +242 -228
  50. data/lib/gitlab/client/versions.rb +16 -0
  51. data/lib/gitlab/configuration.rb +7 -5
  52. data/lib/gitlab/error.rb +3 -1
  53. data/lib/gitlab/file_response.rb +4 -2
  54. data/lib/gitlab/help.rb +9 -9
  55. data/lib/gitlab/objectified_hash.rb +5 -4
  56. data/lib/gitlab/page_links.rb +9 -7
  57. data/lib/gitlab/paginated_response.rb +14 -4
  58. data/lib/gitlab/request.rb +8 -5
  59. data/lib/gitlab/shell.rb +6 -4
  60. data/lib/gitlab/shell_history.rb +7 -5
  61. data/lib/gitlab/version.rb +3 -1
  62. metadata +8 -5
@@ -1,133 +1,133 @@
1
- class Gitlab::Client
2
- # Defines methods related to pipeline schedules.
3
- # @see https://docs.gitlab.com/ce/api/pipeline_schedules.html
4
- module PipelineSchedules
5
- # Gets a list of project pipeline schedules.
6
- #
7
- # @example
8
- # Gitlab.pipeline_schedules(5)
9
- # Gitlab.pipeline_schedules(5, { scope: 'active' })
10
- #
11
- # @param [Integer, String] project the ID or name of a project.
12
- # @param [Hash] options A customizable set of options.
13
- # @options options [String] :scope The scope of pipeline schedules, one of a 'active' or 'inactive'.
14
- # @return [Array<Gitlab::ObjectifiedHash>]
15
- def pipeline_schedules(project, options={})
16
- get("/projects/#{url_encode project}/pipeline_schedules", query: options)
17
- end
1
+ # frozen_string_literal: true
18
2
 
19
- # Gets a single pipeline schedule.
20
- #
21
- # @example
22
- # Gitlab.pipeline_schedule(5, 3)
23
- #
24
- # @param [Integer, String] project The ID or name of a project.
25
- # @param [Integer] id The ID of the pipeline schedule.
26
- # @return [Gitlab::ObjectifiedHash]
27
- def pipeline_schedule(project, id)
28
- get("/projects/#{url_encode project}/pipeline_schedules/#{id}")
29
- end
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
30
19
 
31
- # Create a pipeline schedule.
32
- #
33
- # @example
34
- # Gitlab.create_pipeline_schedule(5, { description: 'example' })
35
- #
36
- # @param [Integer, String] project The ID or name of a project.
37
- # @param [Hash] options A customizable set of options.
38
- # @option options [String] :description The description of pipeline scehdule.
39
- # @option options [String] :ref The branch/tag name will be triggered.
40
- # @option options [String] :cron The cron (e.g. 0 1 * * *).
41
- # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC').
42
- # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
43
- # @return [Array<Gitlab::ObjectifiedHash>]
44
- def create_pipeline_schedule(project, options={})
45
- post("/projects/#{url_encode project}/pipeline_schedules", query: options)
46
- end
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
47
31
 
48
- # Updates the pipeline schedule of a project.
49
- #
50
- # @example
51
- # Gitlab.edit_pipeline_schedule(3, 2, { description: 'example2' })
52
- #
53
- # @param [Integer, String] project The ID or name of a project.
54
- # @param [Integer] The pipeline schedule ID.
55
- # @param [Hash] options A customizable set of options.
56
- # @option options [String] :description The description of pipeline scehdule.
57
- # @option options [String] :ref The branch/tag name will be triggered.
58
- # @option options [String] :cron The cron (e.g. 0 1 * * *).
59
- # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC').
60
- # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
61
- # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule.
62
- def edit_pipeline_schedule(project, pipeline_schedule_id, options={})
63
- put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", query: options)
64
- end
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
65
48
 
66
- # Take ownership of a pipeline schedule.
67
- #
68
- # @example
69
- # Gitlab.pipeline_schedule_take_ownership(5, 1)
70
- #
71
- # @param [Integer, String] project The ID or name of a project.
72
- # @param [Integer] trigger_id The pipeline schedule ID.
73
- # @return [Gitlab::ObjectifiedHash] The updated pipeline schedule.
74
- def pipeline_schedule_take_ownership(project, pipeline_schedule_id)
75
- post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership")
76
- end
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
77
66
 
78
- # Delete a pipeline schedule.
79
- #
80
- # @example
81
- # Gitlab.delete_pipeline_schedule(5, 1)
82
- #
83
- # @param [Integer, String] project The ID or name of a project.
84
- # @param [Integer] trigger_id The pipeline schedule ID.
85
- # @return [Gitlab::ObjectifiedHash] The deleted pipeline schedule.
86
- def delete_pipeline_schedule(project, pipeline_schedule_id)
87
- delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}")
88
- end
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
89
78
 
90
- # Create a pipeline schedule variable.
91
- #
92
- # @example
93
- # Gitlab.create_pipeline_schedule_variable(5, 1, { key: 'foo', value: 'bar' })
94
- #
95
- # @param [Integer, String] project The ID or name of a project.
96
- # @param [Integer] trigger_id The pipeline schedule ID.
97
- # @param [Hash] options A customizable set of options.
98
- # @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.
99
- # @option options [String] :value The value of a variable
100
- # @return [Array<Gitlab::ObjectifiedHash>] The created pipeline schedule variable.
101
- def create_pipeline_schedule_variable(project, pipeline_schedule_id, options={})
102
- post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", query: options)
103
- end
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
90
+
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
104
105
 
105
- # Updates the variable of a pipeline schedule.
106
- #
107
- # @example
108
- # Gitlab.edit_pipeline_schedule_variable(3, 2, "foo" { value: 'bar' })
109
- #
110
- # @param [Integer, String] project The ID or name of a project.
111
- # @param [Integer] The pipeline schedule ID.
112
- # @param [String] The key of a variable.
113
- # @param [Hash] options A customizable set of options.
114
- # @option options [String] :value The value of a variable.
115
- # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule variable.
116
- def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options={})
117
- put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", query: options)
118
- end
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
119
120
 
120
- # Delete the variable of a pipeline schedule
121
- #
122
- # @example
123
- # Gitlab.delete_pipeline_schedule_variable(3, 2, "foo")
124
- #
125
- # @param [Integer, String] project The ID or name of a project.
126
- # @param [Integer] The pipeline schedule ID.
127
- # @param [String] The key of a variable.
128
- # @return [Array<Gitlab::ObjectifiedHash>] The deleted pipeline schedule variable.
129
- def delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, options={})
130
- delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}")
131
- end
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}")
132
132
  end
133
133
  end
@@ -1,101 +1,101 @@
1
- class Gitlab::Client
2
- # Defines methods related to pipelines.
3
- # @see https://docs.gitlab.com/ce/api/pipeline_triggers.html
4
- # @see https://docs.gitlab.com/ce/ci/triggers/README.html
5
- module PipelineTriggers
6
- # Gets a list of the project's pipeline triggers
7
- #
8
- # @example
9
- # Gitlab.triggers(5)
10
- #
11
- # @param [Integer, String] project The ID or name of a project.
12
- # @return [Array<Gitlab::ObjectifiedHash>] The list of triggers.
13
- def triggers(project)
14
- get("/projects/#{url_encode project}/triggers")
15
- end
1
+ # frozen_string_literal: true
16
2
 
17
- # Gets details of project's pipeline trigger.
18
- #
19
- # @example
20
- # Gitlab.trigger(5, 1)
21
- #
22
- # @param [Integer, String] project The ID or name of a project.
23
- # @param [Integer] trigger_id The trigger ID.
24
- # @return [Gitlab::ObjectifiedHash] The trigger.
25
- def trigger(project, trigger_id)
26
- get("/projects/#{url_encode project}/triggers/#{trigger_id}")
27
- end
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
28
17
 
29
- # Create a pipeline trigger for a project.
30
- #
31
- # @example
32
- # Gitlab.create_trigger(5, description: "my description")
33
- #
34
- # @param [Integer, String] project The ID or name of a project.
35
- # @param [String] description The trigger name
36
- # @return [Gitlab::ObjectifiedHash] The created trigger.
37
- def create_trigger(project, description)
38
- post("/projects/#{url_encode project}/triggers", body: {description: description})
39
- end
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
40
29
 
41
- # Update a project trigger
42
- #
43
- # @example
44
- # Gitlab.update_trigger(5, 1, description: "my description")
45
- #
46
- # @param [Integer, String] project The ID or name of a project.
47
- # @param [Integer] trigger_id The trigger ID.
48
- # @param [Hash] options A customizable set of options.
49
- # @option options [String] :description The trigger name.
50
- # @return [Gitlab::ObjectifiedHash] The updated trigger.
51
- def update_trigger(project, trigger_id, options={})
52
- put("/projects/#{url_encode project}/triggers/#{trigger_id}", body: options)
53
- end
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
54
41
 
55
- # Take ownership of a project trigger
56
- #
57
- # @example
58
- # Gitlab.trigger_take_ownership(5, 1)
59
- #
60
- # @param [Integer, String] project The ID or name of a project.
61
- # @param [Integer] trigger_id The trigger ID.
62
- # @return [Gitlab::ObjectifiedHash] The updated trigger.
63
- def trigger_take_ownership(project, trigger_id)
64
- post("/projects/#{url_encode project}/triggers/#{trigger_id}/take_ownership")
65
- end
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
66
55
 
67
- # Remove a project's pipeline trigger.
68
- #
69
- # @example
70
- # Gitlab.remove_trigger(5, 1)
71
- #
72
- # @param [Integer, String] project The ID or name of a project.
73
- # @param [Integer] trigger_id The trigger ID.
74
- # @return [void] This API call returns an empty response body.
75
- def remove_trigger(project, trigger_id)
76
- delete("/projects/#{url_encode project}/triggers/#{trigger_id}")
77
- end
78
- alias_method :delete_trigger, :remove_trigger
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
67
+
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
79
80
 
80
- # Run the given project pipeline trigger.
81
- #
82
- # @example
83
- # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master')
84
- # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" })
85
- #
86
- # @see https://docs.gitlab.com/ce/ci/triggers/README.html
87
- #
88
- # @param [Integer, String] project The ID or name of the project.
89
- # @param [String] token The token of a trigger.
90
- # @param [String] ref Branch or tag name to build.
91
- # @param [Hash] variables A set of build variables to use for the build. (optional)
92
- # @return [Gitlab::ObjectifiedHash] The trigger.
93
- def run_trigger(project, token, ref, variables={})
94
- post("/projects/#{url_encode project}/trigger/pipeline", unauthenticated: true, body: {
95
- token: token,
96
- ref: ref,
97
- variables: variables
98
- })
99
- end
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
+ })
100
100
  end
101
101
  end
@@ -1,68 +1,68 @@
1
- class Gitlab::Client
2
- # Defines methods related to pipelines.
3
- # @see https://docs.gitlab.com/ce/api/pipelines.html
4
- module Pipelines
5
- # Gets a list of project pipelines.
6
- #
7
- # @example
8
- # Gitlab.pipelines(5)
9
- # Gitlab.pipelines(5, { per_page: 10, page: 2 })
10
- #
11
- # @param [Integer, String] project The ID or name of a project.
12
- # @param [Hash] options A customizable set of options.
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>]
16
- def pipelines(project, options={})
17
- get("/projects/#{url_encode project}/pipelines", query: options)
18
- end
1
+ # frozen_string_literal: true
19
2
 
20
- # Gets a single pipeline.
21
- #
22
- # @example
23
- # Gitlab.pipeline(5, 36)
24
- #
25
- # @param [Integer, String] project The ID or name of a project.
26
- # @param [Integer] id The ID of a pipeline.
27
- # @return [Gitlab::ObjectifiedHash]
28
- def pipeline(project, id)
29
- get("/projects/#{url_encode project}/pipelines/#{id}")
30
- end
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
31
20
 
32
- # Create a pipeline.
33
- #
34
- # @example
35
- # Gitlab.create_pipeline(5, 'master')
36
- #
37
- # @param [Integer, String] project The ID or name of a project.
38
- # @param [String] ref Reference to commit.
39
- # @return [Gitlab::ObjectifiedHash] The pipelines changes.
40
- def create_pipeline(project, ref)
41
- post("/projects/#{url_encode project}/pipeline?ref=#{ref}")
42
- end
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
43
32
 
44
- # Cancels a pipeline.
45
- #
46
- # @example
47
- # Gitlab.cancel_pipeline(5, 1)
48
- #
49
- # @param [Integer, String] project The ID or name of a project.
50
- # @param [Integer] id The ID of a pipeline.
51
- # @return [Gitlab::ObjectifiedHash] The pipelines changes.
52
- def cancel_pipeline(project, id)
53
- post("/projects/#{url_encode project}/pipelines/#{id}/cancel")
54
- end
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
44
+
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
55
56
 
56
- # Retry a pipeline.
57
- #
58
- # @example
59
- # Gitlab.retry_pipeline(5, 1)
60
- #
61
- # @param [Integer, String] project The ID or name of a project.
62
- # @param [Integer] id The ID of a pipeline.
63
- # @return [Array<Gitlab::ObjectifiedHash>] The pipelines changes.
64
- def retry_pipeline(project, id)
65
- post("/projects/#{url_encode project}/pipelines/#{id}/retry")
66
- end
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")
67
67
  end
68
68
  end