Module: Gitlab::Client::ProjectBadges
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/project_badges.rb
Overview
Defines methods related to project badges.
Instance Method Summary collapse
-
#add_project_badge(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Adds a badge to a project.
-
#edit_project_badge(project, badge_id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a badge of a project..
-
#preview_project_badge(project, link_url, image_url) ⇒ Gitlab::ObjectifiedHash
Preview a badge from a project.
-
#project_badge(project, badge_id) ⇒ Gitlab::ObjectifiedHash
Gets a badge of a project.
-
#project_badges(project) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of a projects badges and its group badges.
-
#remove_project_badge(project, badge_id) ⇒ nil
Removes a badge from a project.
Instance Method Details
#add_project_badge(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Adds a badge to a project.
40 41 42 |
# File 'lib/gitlab/client/project_badges.rb', line 40 def add_project_badge(project, = {}) post("/projects/#{url_encode project}/badges", body: ) end |
#edit_project_badge(project, badge_id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates a badge of a project..
55 56 57 |
# File 'lib/gitlab/client/project_badges.rb', line 55 def edit_project_badge(project, badge_id, = {}) put("/projects/#{url_encode project}/badges/#{badge_id}", body: ) end |
#preview_project_badge(project, link_url, image_url) ⇒ Gitlab::ObjectifiedHash
Preview a badge from a project.
80 81 82 83 |
# File 'lib/gitlab/client/project_badges.rb', line 80 def preview_project_badge(project, link_url, image_url) query = { link_url: link_url, image_url: image_url } get("/projects/#{url_encode project}/badges/render", query: query) end |
#project_badge(project, badge_id) ⇒ Gitlab::ObjectifiedHash
Gets a badge of a project.
26 27 28 |
# File 'lib/gitlab/client/project_badges.rb', line 26 def project_badge(project, badge_id) get("/projects/#{url_encode project}/badges/#{badge_id}") end |
#project_badges(project) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of a projects badges and its group badges.
14 15 16 |
# File 'lib/gitlab/client/project_badges.rb', line 14 def project_badges(project) get("/projects/#{url_encode project}/badges") end |
#remove_project_badge(project, badge_id) ⇒ nil
Removes a badge from a project. Only projects badges will be removed by using this endpoint.
67 68 69 |
# File 'lib/gitlab/client/project_badges.rb', line 67 def remove_project_badge(project, badge_id) delete("/projects/#{url_encode project}/badges/#{badge_id}") end |