gitlab-faraday 5.1.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.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/lib/gitlab/api.rb +16 -0
  3. data/lib/gitlab/client/access_requests.rb +103 -0
  4. data/lib/gitlab/client/application_settings.rb +172 -0
  5. data/lib/gitlab/client/avatar.rb +21 -0
  6. data/lib/gitlab/client/award_emojis.rb +137 -0
  7. data/lib/gitlab/client/boards.rb +146 -0
  8. data/lib/gitlab/client/branches.rb +135 -0
  9. data/lib/gitlab/client/broadcast_messages.rb +75 -0
  10. data/lib/gitlab/client/build_variables.rb +135 -0
  11. data/lib/gitlab/client/builds.rb +108 -0
  12. data/lib/gitlab/client/commits.rb +216 -0
  13. data/lib/gitlab/client/container_registry.rb +90 -0
  14. data/lib/gitlab/client/deployments.rb +34 -0
  15. data/lib/gitlab/client/environments.rb +89 -0
  16. data/lib/gitlab/client/epic_issues.rb +23 -0
  17. data/lib/gitlab/client/epics.rb +73 -0
  18. data/lib/gitlab/client/events.rb +60 -0
  19. data/lib/gitlab/client/features.rb +48 -0
  20. data/lib/gitlab/client/group_badges.rb +88 -0
  21. data/lib/gitlab/client/group_boards.rb +141 -0
  22. data/lib/gitlab/client/group_labels.rb +88 -0
  23. data/lib/gitlab/client/group_milestones.rb +94 -0
  24. data/lib/gitlab/client/groups.rb +526 -0
  25. data/lib/gitlab/client/issue_links.rb +48 -0
  26. data/lib/gitlab/client/issues.rb +242 -0
  27. data/lib/gitlab/client/jobs.rb +250 -0
  28. data/lib/gitlab/client/keys.rb +29 -0
  29. data/lib/gitlab/client/labels.rb +88 -0
  30. data/lib/gitlab/client/lint.rb +19 -0
  31. data/lib/gitlab/client/markdown.rb +23 -0
  32. data/lib/gitlab/client/merge_request_approvals.rb +265 -0
  33. data/lib/gitlab/client/merge_requests.rb +415 -0
  34. data/lib/gitlab/client/merge_trains.rb +55 -0
  35. data/lib/gitlab/client/milestones.rb +106 -0
  36. data/lib/gitlab/client/namespaces.rb +22 -0
  37. data/lib/gitlab/client/notes.rb +313 -0
  38. data/lib/gitlab/client/packages.rb +95 -0
  39. data/lib/gitlab/client/pipeline_schedules.rb +159 -0
  40. data/lib/gitlab/client/pipeline_triggers.rb +103 -0
  41. data/lib/gitlab/client/pipelines.rb +130 -0
  42. data/lib/gitlab/client/project_badges.rb +85 -0
  43. data/lib/gitlab/client/project_clusters.rb +83 -0
  44. data/lib/gitlab/client/project_exports.rb +54 -0
  45. data/lib/gitlab/client/project_release_links.rb +76 -0
  46. data/lib/gitlab/client/project_releases.rb +90 -0
  47. data/lib/gitlab/client/projects.rb +792 -0
  48. data/lib/gitlab/client/protected_tags.rb +59 -0
  49. data/lib/gitlab/client/remote_mirrors.rb +90 -0
  50. data/lib/gitlab/client/repositories.rb +130 -0
  51. data/lib/gitlab/client/repository_files.rb +131 -0
  52. data/lib/gitlab/client/repository_submodules.rb +27 -0
  53. data/lib/gitlab/client/resource_label_events.rb +82 -0
  54. data/lib/gitlab/client/resource_state_events.rb +57 -0
  55. data/lib/gitlab/client/runners.rb +278 -0
  56. data/lib/gitlab/client/search.rb +66 -0
  57. data/lib/gitlab/client/services.rb +53 -0
  58. data/lib/gitlab/client/sidekiq.rb +39 -0
  59. data/lib/gitlab/client/snippets.rb +95 -0
  60. data/lib/gitlab/client/system_hooks.rb +64 -0
  61. data/lib/gitlab/client/tags.rb +97 -0
  62. data/lib/gitlab/client/templates.rb +100 -0
  63. data/lib/gitlab/client/todos.rb +46 -0
  64. data/lib/gitlab/client/user_snippets.rb +114 -0
  65. data/lib/gitlab/client/users.rb +521 -0
  66. data/lib/gitlab/client/versions.rb +18 -0
  67. data/lib/gitlab/client/wikis.rb +79 -0
  68. data/lib/gitlab/client.rb +96 -0
  69. data/lib/gitlab/configuration.rb +36 -0
  70. data/lib/gitlab/error.rb +114 -0
  71. data/lib/gitlab/file_response.rb +43 -0
  72. data/lib/gitlab/headers/page_links.rb +32 -0
  73. data/lib/gitlab/headers/total.rb +24 -0
  74. data/lib/gitlab/objectified_hash.rb +44 -0
  75. data/lib/gitlab/paginated_response.rb +114 -0
  76. data/lib/gitlab/request.rb +144 -0
  77. data/lib/gitlab/version.rb +5 -0
  78. data/lib/gitlab.rb +36 -0
  79. metadata +156 -0
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to tags.
5
+ # @see https://docs.gitlab.com/ce/api/tags.html
6
+ module Tags
7
+ # Gets a list of project repository tags.
8
+ #
9
+ # @example
10
+ # Gitlab.tags(42)
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 tags(project, options = {})
18
+ get("/projects/#{url_encode project}/repository/tags", query: options)
19
+ end
20
+ alias repo_tags tags
21
+
22
+ # Creates a new project repository tag.
23
+ #
24
+ # @example
25
+ # Gitlab.create_tag(42, 'new_tag', 'master')
26
+ # Gitlab.create_tag(42, 'v1.0', 'master', 'Release 1.0')
27
+ #
28
+ # @param [Integer, String] project The ID or name of a project.
29
+ # @param [String] tag_name The name of the new tag.
30
+ # @param [String] ref The ref (commit sha, branch name, or another tag) the tag will point to.
31
+ # @param [String] message Optional message for tag, creates annotated tag if specified.
32
+ # @param [String] description Optional release notes for tag.
33
+ # @return [Gitlab::ObjectifiedHash]
34
+ def create_tag(project, tag_name, ref, message = '', description = nil)
35
+ post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description })
36
+ end
37
+ alias repo_create_tag create_tag
38
+
39
+ # Gets information about a repository tag.
40
+ #
41
+ # @example
42
+ # Gitlab.tag(3, 'api')
43
+ # Gitlab.repo_tag(5, 'master')
44
+ #
45
+ # @param [Integer, String] project The ID or name of a project.
46
+ # @param [String] tag The name of the tag.
47
+ # @return [Gitlab::ObjectifiedHash]
48
+ def tag(project, tag)
49
+ get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
50
+ end
51
+ alias repo_tag tag
52
+
53
+ # Deletes a repository tag. Requires Gitlab >= 6.8.x
54
+ #
55
+ # @example
56
+ # Gitlab.delete_tag(3, 'api')
57
+ # Gitlab.repo_delete_tag(5, 'master')
58
+ #
59
+ # @param [Integer, String] project The ID or name of a project.
60
+ # @param [String] tag The name of the tag to delete
61
+ # @return [Gitlab::ObjectifiedHash]
62
+ def delete_tag(project, tag)
63
+ delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
64
+ end
65
+ alias repo_delete_tag delete_tag
66
+
67
+ # Adds release notes to an existing repository tag. Requires Gitlab >= 8.2.0
68
+ #
69
+ # @example
70
+ # Gitlab.create_release(3, '1.0.0', 'This is ready for production')
71
+ # Gitlab.repo_create_release(5, '1.0.0', 'This is ready for production')
72
+ #
73
+ # @param [Integer, String] project The ID or name of a project.
74
+ # @param [String] tag The name of the new tag.
75
+ # @param [String] description Release notes with markdown support
76
+ # @return [Gitlab::ObjectifiedHash]
77
+ def create_release(project, tag, description)
78
+ post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
79
+ end
80
+ alias repo_create_release create_release
81
+
82
+ # Updates the release notes of a given release. Requires Gitlab >= 8.2.0
83
+ #
84
+ # @example
85
+ # Gitlab.update_release(3, '1.0.0', 'This is even more ready for production')
86
+ # Gitlab.repo_update_release(5, '1.0.0', 'This is even more ready for production')
87
+ #
88
+ # @param [Integer, String] project The ID or name of a project.
89
+ # @param [String] tag The name of the new tag.
90
+ # @param [String] description Release notes with markdown support
91
+ # @return [Gitlab::ObjectifiedHash]
92
+ def update_release(project, tag, description)
93
+ put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
94
+ end
95
+ alias repo_update_release update_release
96
+ end
97
+ 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,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to todos
5
+ # @see https://docs.gitlab.com/ce/api/todos.html
6
+ module Todos
7
+ # Gets a list of todos.
8
+ #
9
+ # @example
10
+ # Gitlab.todos
11
+ # Gitlab.todos({ action: 'assigned' })
12
+ # Gitlab.todos({ state: 'pending' })
13
+ #
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [Integer] :action The action to be filtered. Can be `assigned`, `mentioned`, `build_failed`, `marked`, or `approval_required`.
16
+ # @option options [Integer] :author_id The ID of an author
17
+ # @option options [Integer] :project_id The ID of a project
18
+ # @option options [Integer] :state The state of the todo. Can be either `pending` or `done`
19
+ # @option options [Integer] :type The type of a todo. Can be either `Issue` or `MergeRequest`
20
+ # @return [Array<Gitlab::ObjectifiedHash>]
21
+ def todos(options = {})
22
+ get('/todos', query: options)
23
+ end
24
+
25
+ # Marks a single pending todo for the current user as done.
26
+ #
27
+ # @example
28
+ # Gitlab.mark_todo_as_done(42)
29
+ #
30
+ # @param [Integer] id The ID of the todo.
31
+ # @return [Gitlab::ObjectifiedHash]
32
+ def mark_todo_as_done(id)
33
+ post("/todos/#{id}/mark_as_done")
34
+ end
35
+
36
+ # Marks all todos for the current user as done
37
+ #
38
+ # @example
39
+ # Gitlab.mark_all_todos_as_done
40
+ #
41
+ # @return [void] This API call returns an empty response body.
42
+ def mark_all_todos_as_done
43
+ post('/todos/mark_as_done')
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to user snippets.
5
+ # @see https://docs.gitlab.com/ce/api/snippets.html
6
+ module UserSnippets
7
+ # Get a list of the snippets of the current user.
8
+ #
9
+ # @example
10
+ # Gitlab.user_snippets
11
+ #
12
+ # @return [Array<Gitlab::ObjectifiedHash>] List of snippets of current user
13
+ def user_snippets
14
+ get('/snippets')
15
+ end
16
+
17
+ # Get a single snippet.
18
+ #
19
+ # @example
20
+ # Gitlab.user_snippet(1)
21
+ #
22
+ # @param [Integer] id ID of snippet to retrieve.
23
+ # @return [Gitlab::ObjectifiedHash] Information about the user snippet
24
+ def user_snippet(id)
25
+ get("/snippets/#{id}")
26
+ end
27
+
28
+ # Get raw contents of a single snippet.
29
+ #
30
+ # @example
31
+ # Gitlab.user_snippet_raw(1)
32
+ #
33
+ # @param [Integer] id ID of snippet to retrieve.
34
+ # @return [String] User snippet text
35
+ def user_snippet_raw(id)
36
+ get("/snippets/#{id}/raw",
37
+ format: nil,
38
+ headers: { Accept: 'text/plain' },
39
+ parser: ::Gitlab::Request::Parser)
40
+ end
41
+
42
+ # Create a new snippet.
43
+ #
44
+ # @example
45
+ # Gitlab.create_user_snippet({ title: 'REST', file_name: 'api.rb', content: 'some code', description: 'Hello World snippet', visibility: 'public'})
46
+ #
47
+ # @param [Hash] options A customizable set of options.
48
+ # @option options [String] :title (required) Title of a snippet.
49
+ # @option options [String] :file_name (required) Name of a snippet file.
50
+ # @option options [String] :content (required) Content of a snippet.
51
+ # @option options [String] :description (optional) Description of a snippet.
52
+ # @option options [String] :visibility (optional) visibility of a snippet.
53
+ # @return [Gitlab::ObjectifiedHash] Information about created snippet.
54
+ def create_user_snippet(options = {})
55
+ post('/snippets', body: options)
56
+ end
57
+
58
+ # Update an existing snippet.
59
+ #
60
+ # @example
61
+ # Gitlab.edit_user_snippet(34, { file_name: 'README.txt' })
62
+ # Gitlab.edit_user_snippet(34, { file_name: 'README.txt', title: 'New title' })
63
+ #
64
+ # @param [Integer] id ID of snippet to update.
65
+ # @param [Hash] options A customizable set of options.
66
+ # @option options [String] :title (optional) Title of a snippet.
67
+ # @option options [String] :file_name (optional) Name of a snippet file.
68
+ # @option options [String] :content (optional) Content of a snippet.
69
+ # @option options [String] :description (optional) Description of a snippet.
70
+ # @option options [String] :visibility (optional) visibility of a snippet.
71
+ # @return [Gitlab::ObjectifiedHash] Information about updated snippet.
72
+ def edit_user_snippet(id, options = {})
73
+ put("/snippets/#{id}", body: options)
74
+ end
75
+
76
+ # Delete an existing snippet.
77
+ #
78
+ # @example
79
+ # Gitlab.delete_user_snippet(14)
80
+ #
81
+ # @param [Integer] id ID of snippet to delete.
82
+ # @return [void] This API call returns an empty response body.
83
+ def delete_user_snippet(id)
84
+ delete("/snippets/#{id}")
85
+ end
86
+
87
+ # List all public snippets.
88
+ #
89
+ # @example
90
+ # Gitlab.public_snippets
91
+ # Gitlab.public_snippets(per_page: 2, page: 1)
92
+ #
93
+ # @param [Hash] options A customizable set of options.
94
+ # @option options [String] :per_page (optional) Number of snippets to return per page.
95
+ # @option options [String] :page (optional) Page to retrieve.
96
+ #
97
+ # @return [Array<Gitlab::ObjectifiedHash>] List of all public snippets
98
+ def public_snippets(options = {})
99
+ get('/snippets/public', query: options)
100
+ end
101
+
102
+ # Get user agent details for a snippet.
103
+ #
104
+ # @example
105
+ # Gitlab.snippet_user_agent_details(1)
106
+ #
107
+ # @param [Integer] id ID of snippet to delete.
108
+ #
109
+ # @return [Array<Gitlab::ObjectifiedHash>] Details of the user agent
110
+ def snippet_user_agent_details(id)
111
+ get("/snippets/#{id}/user_agent_detail")
112
+ end
113
+ end
114
+ end