Class: Repos

Inherits:
Object
  • Object
show all
Defined in:
lib/github/repos/repos.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github) ⇒ Repos

Returns a new instance of Repos.



4
5
6
7
8
9
10
11
12
13
# File 'lib/github/repos/repos.rb', line 4

def initialize(github)
  @github = github
  @collaborators = ReposCollaborators.new(github)
  @commits = ReposCommits.new(github)
  @downloads = ReposDownloads.new(github)
  @forks = ReposForks.new(github)
  @keys = ReposKeys.new(github)
  @watching = ReposWatching.new(github)
  @hooks = ReposHooks.new(github)
end

Instance Attribute Details

#collaboratorsObject

Returns the value of attribute collaborators.



2
3
4
# File 'lib/github/repos/repos.rb', line 2

def collaborators
  @collaborators
end

#commitsObject

Returns the value of attribute commits.



2
3
4
# File 'lib/github/repos/repos.rb', line 2

def commits
  @commits
end

#downloadsObject

Returns the value of attribute downloads.



2
3
4
# File 'lib/github/repos/repos.rb', line 2

def downloads
  @downloads
end

#forksObject

Returns the value of attribute forks.



2
3
4
# File 'lib/github/repos/repos.rb', line 2

def forks
  @forks
end

#githubObject

Returns the value of attribute github.



2
3
4
# File 'lib/github/repos/repos.rb', line 2

def github
  @github
end

#hooksObject

Returns the value of attribute hooks.



2
3
4
# File 'lib/github/repos/repos.rb', line 2

def hooks
  @hooks
end

#keysObject

Returns the value of attribute keys.



2
3
4
# File 'lib/github/repos/repos.rb', line 2

def keys
  @keys
end

#watchingObject

Returns the value of attribute watching.



2
3
4
# File 'lib/github/repos/repos.rb', line 2

def watching
  @watching
end

Instance Method Details

#createOrgRepo(org, name, description = nil, homepage = nil, private = FALSE, has_issues = TRUE, has_wiki = TRUE, has_downloads = TRUE) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/github/repos/repos.rb', line 41

def createOrgRepo(org, name, description=nil, homepage=nil, private=FALSE,
    has_issues=TRUE, has_wiki=TRUE, has_downloads=TRUE)
  params = {
      :name => name,
      :private => private,
      :has_issues => has_issues,
      :has_wiki => has_wiki,
      :has_downloads => has_downloads,
      :description => description,
      :homepage => homepage
  }
  params = @github.removeEmptyParams(params)
  data = params.to_json
  @github.post('orgs/%s/repos' % org, data)
end

#createUserRepo(name, description = nil, homepage = nil, private = FALSE, has_issues = TRUE, has_wiki = TRUE, has_downloads = TRUE) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/github/repos/repos.rb', line 21

def createUserRepo(name, description=nil, homepage=nil, private=FALSE, has_issues=TRUE, has_wiki=TRUE,
    has_downloads=TRUE)
  params = {
      :name => name,
      :private => private,
      :has_issues => has_issues,
      :has_wiki => has_wiki,
      :has_downloads => has_downloads,
      :description => description,
      :homepage => homepage
  }
  params = @github.removeEmptyParams(params)
  data = params.to_json
  @github.post('user/repos', data)
end

#editRepo(repo, name, description = nil, homepage = nil, private = FALSE, has_issues = TRUE, has_wiki = TRUE, has_downloads = TRUE, user = nil) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/github/repos/repos.rb', line 62

def editRepo(repo, name, description=nil, homepage=nil, private=FALSE,
    has_issues=TRUE, has_wiki=TRUE, has_downloads=TRUE, user=nil)
  username = user == nil ? @github.username : user
  params = {
      :name => name,
      :description => description,
      :homepage => homepage,
      :private => private,
      :has_issues => has_issues,
      :has_wiki => has_wiki,
      :has_downloads => has_downloads
  }
  params = @github.removeEmptyParams(params)
  data = params.to_json
  @github.patch('repos/%s/%s' % [username, repo], data)
end

#getRepo(repo, user = nil) ⇒ Object



57
58
59
60
# File 'lib/github/repos/repos.rb', line 57

def getRepo(repo, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s' % [username, repo])
end

#listBranches(repo, user = nil) ⇒ Object



100
101
102
103
# File 'lib/github/repos/repos.rb', line 100

def listBranches(repo, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s/branches' % [username, repo])
end

#listContributors(repo, user = nil) ⇒ Object



79
80
81
82
83
# File 'lib/github/repos/repos.rb', line 79

def listContributors(repo, user=nil)
  username = user == nil ? @github.username : user
  @github.get(
      'repos/%s/%s/contributors' % [username, repo])
end

#listLangs(repo, user = nil) ⇒ Object



85
86
87
88
# File 'lib/github/repos/repos.rb', line 85

def listLangs(repo, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s/languages' % [username, repo])
end

#listOrgRepos(org) ⇒ Object



37
38
39
# File 'lib/github/repos/repos.rb', line 37

def listOrgRepos(org)
  @github.get('orgs/%s/repos' % org)
end

#listRepos(user = nil) ⇒ Object



15
16
17
18
19
# File 'lib/github/repos/repos.rb', line 15

def listRepos(user=nil)
  username = user == nil ? @github.username : user
  url = 'users/%s/repos' % user != @github.username ? username : 'user/repos'
  @github.get(url)
end

#listTags(repo, user = nil) ⇒ Object



95
96
97
98
# File 'lib/github/repos/repos.rb', line 95

def listTags(repo, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s/tags' % [username, repo])
end

#listTeams(repo, user = nil) ⇒ Object



90
91
92
93
# File 'lib/github/repos/repos.rb', line 90

def listTeams(repo, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s/teams' % [username, repo])
end