Class: BitbucketServer::Representation::Repo
- Inherits:
-
Base
- Object
- Base
- BitbucketServer::Representation::Repo
show all
- Defined in:
- lib/bitbucket_server/representation/repo.rb
Instance Attribute Summary
Attributes inherited from Base
#raw
Instance Method Summary
collapse
Methods inherited from Base
convert_timestamp, decorate
Constructor Details
#initialize(raw) ⇒ Repo
Returns a new instance of Repo.
6
7
8
|
# File 'lib/bitbucket_server/representation/repo.rb', line 6
def initialize(raw)
super(raw)
end
|
Instance Method Details
#browse_url ⇒ Object
22
23
24
25
26
|
# File 'lib/bitbucket_server/representation/repo.rb', line 22
def browse_url
raw.dig('links', 'self').first.fetch('href')
end
|
#clone_url ⇒ Object
28
29
30
|
# File 'lib/bitbucket_server/representation/repo.rb', line 28
def clone_url
raw['links']['clone'].find { |link| link['name'].starts_with?('http') }.fetch('href')
end
|
#description ⇒ Object
32
33
34
|
# File 'lib/bitbucket_server/representation/repo.rb', line 32
def description
project['description']
end
|
#full_name ⇒ Object
36
37
38
|
# File 'lib/bitbucket_server/representation/repo.rb', line 36
def full_name
"#{project_name}/#{name}"
end
|
#issues_enabled? ⇒ Boolean
40
41
42
|
# File 'lib/bitbucket_server/representation/repo.rb', line 40
def issues_enabled?
true
end
|
#name ⇒ Object
44
45
46
|
# File 'lib/bitbucket_server/representation/repo.rb', line 44
def name
raw['name']
end
|
#project ⇒ Object
60
61
62
|
# File 'lib/bitbucket_server/representation/repo.rb', line 60
def project
raw['project']
end
|
#project_key ⇒ Object
10
11
12
|
# File 'lib/bitbucket_server/representation/repo.rb', line 10
def project_key
raw.dig('project', 'key')
end
|
#project_name ⇒ Object
14
15
16
|
# File 'lib/bitbucket_server/representation/repo.rb', line 14
def project_name
raw.dig('project', 'name')
end
|
#slug ⇒ Object
18
19
20
|
# File 'lib/bitbucket_server/representation/repo.rb', line 18
def slug
raw['slug']
end
|
#to_s ⇒ Object
64
65
66
|
# File 'lib/bitbucket_server/representation/repo.rb', line 64
def to_s
full_name
end
|
#valid? ⇒ Boolean
48
49
50
|
# File 'lib/bitbucket_server/representation/repo.rb', line 48
def valid?
raw['scmId'] == 'git'
end
|
#visibility_level ⇒ Object