Class: Bitbucket::Representation::Repo
- Inherits:
-
Base
- Object
- Base
- Bitbucket::Representation::Repo
show all
- Defined in:
- lib/bitbucket/representation/repo.rb
Instance Attribute Summary
Attributes inherited from Base
#raw
Instance Method Summary
collapse
Methods inherited from Base
decorate, #initialize
Instance Method Details
#clone_url(token = nil, auth_type: nil) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/bitbucket/representation/repo.rb', line 18
def clone_url(token = nil, auth_type: nil)
url = raw['links']['clone'].find { |link| link['name'] == 'https' }.fetch('href')
if token.present?
clone_url = URI.parse(url)
clone_url.user = if auth_type == :basic
token
else
"x-token-auth:#{token}"
end
clone_url.to_s
else
url
end
end
|
#default_branch ⇒ Object
68
69
70
|
# File 'lib/bitbucket/representation/repo.rb', line 68
def default_branch
raw.dig('mainbranch', 'name')
end
|
#description ⇒ Object
36
37
38
|
# File 'lib/bitbucket/representation/repo.rb', line 36
def description
raw['description']
end
|
#error ⇒ Object
76
77
78
|
# File 'lib/bitbucket/representation/repo.rb', line 76
def error
raw['error']
end
|
#full_name ⇒ Object
40
41
42
|
# File 'lib/bitbucket/representation/repo.rb', line 40
def full_name
raw['full_name']
end
|
#has_wiki? ⇒ Boolean
56
57
58
|
# File 'lib/bitbucket/representation/repo.rb', line 56
def has_wiki?
raw['has_wiki']
end
|
#issues_enabled? ⇒ Boolean
44
45
46
|
# File 'lib/bitbucket/representation/repo.rb', line 44
def issues_enabled?
raw['has_issues']
end
|
#name ⇒ Object
48
49
50
|
# File 'lib/bitbucket/representation/repo.rb', line 48
def name
raw['name']
end
|
#owner ⇒ Object
10
11
12
|
# File 'lib/bitbucket/representation/repo.rb', line 10
def owner
owner_and_slug.first
end
|
#owner_and_slug ⇒ Object
6
7
8
|
# File 'lib/bitbucket/representation/repo.rb', line 6
def owner_and_slug
@owner_and_slug ||= full_name.split('/', 2)
end
|
#slug ⇒ Object
14
15
16
|
# File 'lib/bitbucket/representation/repo.rb', line 14
def slug
owner_and_slug.last
end
|
#to_s ⇒ Object
72
73
74
|
# File 'lib/bitbucket/representation/repo.rb', line 72
def to_s
full_name
end
|
#valid? ⇒ Boolean
52
53
54
|
# File 'lib/bitbucket/representation/repo.rb', line 52
def valid?
raw['scm'] == 'git'
end
|
#visibility_level ⇒ Object