Skip to content

Commit

Permalink
Merge pull request #679 from capripot/project-latest-release
Browse files Browse the repository at this point in the history
Add Project's latest release
  • Loading branch information
NARKOZ authored Jun 13, 2024
2 parents 35dcb04 + 8cb4ce5 commit 2df4996
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/gitlab/client/project_releases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,16 @@ def update_project_release(project, tag_name, options = {})
def delete_project_release(project, tag_name)
delete("/projects/#{url_encode project}/releases/#{tag_name}")
end

# Gets Latest Release
#
# @example
# Gitlab.project_latest_release(5)
#
# @param [Integer, String] project The ID or name of a project
# @return [Gitlab::ObjectifiedHash] Information about the release
def project_latest_release(project)
get("/projects/#{url_encode project}/releases/permalink/latest")
end
end
end
15 changes: 15 additions & 0 deletions spec/gitlab/client/project_releases_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@
end
end

describe '.project_latest_release' do
before do
stub_get('/projects/3/releases/permalink/latest', 'project_latest_release')
@project_latest_release = Gitlab.project_latest_release(3)
end

it 'gets the correct resource' do
expect(a_get('/projects/3/releases/v0.1')).to have_been_made
end

it 'returns information about a release' do
expect(@project_release.tag_name).to eq('v0.1')
end
end

describe '.create_project_release' do
context 'without asset links' do
before do
Expand Down

0 comments on commit 2df4996

Please sign in to comment.