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) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/bitbucket/representation/repo.rb', line 18
def clone_url(token = nil)
url = raw['links']['clone'].find { |link| link['name'] == 'https' }.fetch('href')
if token.present?
clone_url = URI.parse(url)
clone_url.user = "x-token-auth:#{token}"
clone_url.to_s
else
url
end
end
|
#description ⇒ Object
30
31
32
|
# File 'lib/bitbucket/representation/repo.rb', line 30
def description
raw['description']
end
|
#full_name ⇒ Object
34
35
36
|
# File 'lib/bitbucket/representation/repo.rb', line 34
def full_name
raw['full_name']
end
|
#has_wiki? ⇒ Boolean
50
51
52
|
# File 'lib/bitbucket/representation/repo.rb', line 50
def has_wiki?
raw['has_wiki']
end
|
#issues_enabled? ⇒ Boolean
38
39
40
|
# File 'lib/bitbucket/representation/repo.rb', line 38
def issues_enabled?
raw['has_issues']
end
|
#name ⇒ Object
42
43
44
|
# File 'lib/bitbucket/representation/repo.rb', line 42
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
62
63
64
|
# File 'lib/bitbucket/representation/repo.rb', line 62
def to_s
full_name
end
|
#valid? ⇒ Boolean
46
47
48
|
# File 'lib/bitbucket/representation/repo.rb', line 46
def valid?
raw['scm'] == 'git'
end
|
#visibility_level ⇒ Object