gitlab-org--gitlab-foss/lib/bitbucket_server/representation/repo.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.2 KiB
Ruby
Raw Normal View History

2018-07-25 08:22:53 -04:00
# frozen_string_literal: true
module BitbucketServer
module Representation
class Repo < Representation::Base
def project_key
raw.dig('project', 'key')
end
def project_name
raw.dig('project', 'name')
end
def slug
raw['slug']
end
2018-07-01 08:55:23 -04:00
def browse_url
# The JSON response contains an array of 1 element. Not sure if there
2018-07-26 00:45:13 -04:00
# are cases where multiple links would be provided.
raw.dig('links', 'self').first.fetch('href')
2018-07-01 08:55:23 -04:00
end
def clone_url
raw['links']['clone'].find { |link| link['name'].starts_with?('http') }.fetch('href')
end
def description
raw['description']
end
def full_name
"#{project_name}/#{name}"
end
def issues_enabled?
true
end
def name
raw['name']
end
def valid?
raw['scmId'] == 'git'
end
def visibility_level
if project['public']
Gitlab::VisibilityLevel::PUBLIC
else
Gitlab::VisibilityLevel::PRIVATE
end
end
def project
raw['project']
end
def to_s
full_name
end
end
end
end