2018-11-18 11:00:15 +05:30
|
|
|
# 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
|
|
|
|
|
|
|
|
def browse_url
|
2019-09-04 21:01:54 +05:30
|
|
|
# The JSON response contains an array of 1 element. Not sure if there
|
2018-11-18 11:00:15 +05:30
|
|
|
# are cases where multiple links would be provided.
|
|
|
|
raw.dig('links', 'self').first.fetch('href')
|
|
|
|
end
|
|
|
|
|
|
|
|
def clone_url
|
|
|
|
raw['links']['clone'].find { |link| link['name'].starts_with?('http') }.fetch('href')
|
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
2022-04-04 11:22:00 +05:30
|
|
|
raw['description']
|
2018-11-18 11:00:15 +05:30
|
|
|
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
|