Module: Gitlab::Client::Snippets
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/snippets.rb
Overview
Defines methods related to snippets.
Instance Method Summary collapse
-
#create_snippet(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new snippet.
-
#delete_snippet(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a snippet.
-
#edit_snippet(project, id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a snippet.
-
#snippet(project, id) ⇒ Gitlab::ObjectifiedHash
Gets information about a snippet.
-
#snippet_content(project, id) ⇒ Gitlab::ObjectifiedHash
Returns raw project snippet content as plain text.
-
#snippets(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Gets a list of project’s snippets.
Instance Method Details
#create_snippet(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new snippet.
46 47 48 |
# File 'lib/gitlab/client/snippets.rb', line 46 def create_snippet(project, = {}) post("/projects/#{url_encode project}/snippets", body: ) end |
#delete_snippet(project, id) ⇒ Gitlab::ObjectifiedHash
Deletes a snippet.
76 77 78 |
# File 'lib/gitlab/client/snippets.rb', line 76 def delete_snippet(project, id) delete("/projects/#{url_encode project}/snippets/#{id}") end |
#edit_snippet(project, id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a snippet.
64 65 66 |
# File 'lib/gitlab/client/snippets.rb', line 64 def edit_snippet(project, id, = {}) put("/projects/#{url_encode project}/snippets/#{id}", body: ) end |
#snippet(project, id) ⇒ Gitlab::ObjectifiedHash
Gets information about a snippet.
29 30 31 |
# File 'lib/gitlab/client/snippets.rb', line 29 def snippet(project, id) get("/projects/#{url_encode project}/snippets/#{id}") end |
#snippet_content(project, id) ⇒ Gitlab::ObjectifiedHash
Returns raw project snippet content as plain text.
88 89 90 91 92 93 |
# File 'lib/gitlab/client/snippets.rb', line 88 def snippet_content(project, id) get("/projects/#{url_encode project}/snippets/#{id}/raw", format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser) end |
#snippets(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Gets a list of project’s snippets.
17 18 19 |
# File 'lib/gitlab/client/snippets.rb', line 17 def snippets(project, = {}) get("/projects/#{url_encode project}/snippets", query: ) end |