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 12:22:53 +00: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 12:55:23 +00:00
def browse_url
# The JSON response contains an array of 1 element. Not sure if there
2018-07-26 04:45:13 +00:00
# are cases where multiple links would be provided.
raw.dig('links', 'self').first.fetch('href')
2018-07-01 12:55:23 +00: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