Module: Gitlab::Client::UserSnippets
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/user_snippets.rb
Overview
Defines methods related to user snippets.
Instance Method Summary collapse
-
#create_user_snippet(options = {}) ⇒ Gitlab::ObjectifiedHash
Create a new snippet.
-
#delete_user_snippet(id) ⇒ void
Delete an existing snippet.
-
#edit_user_snippet(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Update an existing snippet.
-
#public_snippets(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
List all public snippets.
-
#snippet_user_agent_details(id) ⇒ Array<Gitlab::ObjectifiedHash>
Get user agent details for a snippet.
-
#user_snippet(id) ⇒ Gitlab::ObjectifiedHash
Get a single snippet.
-
#user_snippet_raw(id) ⇒ String
Get raw contents of a single snippet.
-
#user_snippets ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of the snippets of the current user.
Instance Method Details
#create_user_snippet(options = {}) ⇒ Gitlab::ObjectifiedHash
Create a new snippet.
54 55 56 |
# File 'lib/gitlab/client/user_snippets.rb', line 54 def create_user_snippet( = {}) post('/snippets', body: ) end |
#delete_user_snippet(id) ⇒ void
This method returns an undefined value.
Delete an existing snippet.
83 84 85 |
# File 'lib/gitlab/client/user_snippets.rb', line 83 def delete_user_snippet(id) delete("/snippets/#{id}") end |
#edit_user_snippet(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Update an existing snippet.
72 73 74 |
# File 'lib/gitlab/client/user_snippets.rb', line 72 def edit_user_snippet(id, = {}) put("/snippets/#{id}", body: ) end |
#public_snippets(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
List all public snippets.
98 99 100 |
# File 'lib/gitlab/client/user_snippets.rb', line 98 def public_snippets( = {}) get('/snippets/public', query: ) end |
#snippet_user_agent_details(id) ⇒ Array<Gitlab::ObjectifiedHash>
Get user agent details for a snippet.
110 111 112 |
# File 'lib/gitlab/client/user_snippets.rb', line 110 def snippet_user_agent_details(id) get("/snippets/#{id}/user_agent_detail") end |
#user_snippet(id) ⇒ Gitlab::ObjectifiedHash
Get a single snippet.
24 25 26 |
# File 'lib/gitlab/client/user_snippets.rb', line 24 def user_snippet(id) get("/snippets/#{id}") end |
#user_snippet_raw(id) ⇒ String
Get raw contents of a single snippet.
35 36 37 38 39 40 |
# File 'lib/gitlab/client/user_snippets.rb', line 35 def user_snippet_raw(id) get("/snippets/#{id}/raw", format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser) end |
#user_snippets ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of the snippets of the current user.
13 14 15 |
# File 'lib/gitlab/client/user_snippets.rb', line 13 def user_snippets get('/snippets') end |