rubhub 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +0 -0
- data/lib/github/events/events.rb +45 -0
- data/lib/github/gists/gists.rb +66 -0
- data/lib/github/gists/gists_comments.rb +35 -0
- data/lib/github/gitdata/gitdata.rb +12 -0
- data/lib/github/gitdata/gitdata_blobs.rb +24 -0
- data/lib/github/gitdata/gitdata_commits.rb +42 -0
- data/lib/github/gitdata/gitdata_references.rb +44 -0
- data/lib/github/gitdata/gitdata_tags.rb +33 -0
- data/lib/github/gitdata/gitdata_trees.rb +25 -0
- data/lib/github/github.rb +95 -0
- data/lib/github/issues/issues.rb +84 -0
- data/lib/github/issues/issues_comments.rb +40 -0
- data/lib/github/issues/issues_events.rb +22 -0
- data/lib/github/issues/issues_labels.rb +76 -0
- data/lib/github/issues/issues_milestones.rb +54 -0
- data/lib/github/orgs/orgs.rb +32 -0
- data/lib/github/orgs/orgs_members.rb +40 -0
- data/lib/github/orgs/orgs_teams.rb +78 -0
- data/lib/github/pullreqs/pullreqs.rb +76 -0
- data/lib/github/pullreqs/pullreqs_reviewcomments.rb +53 -0
- data/lib/github/repos/repos.rb +104 -0
- data/lib/github/repos/repos_collaborators.rb +27 -0
- data/lib/github/repos/repos_commits.rb +72 -0
- data/lib/github/repos/repos_downloads.rb +55 -0
- data/lib/github/repos/repos_forks.rb +25 -0
- data/lib/github/repos/repos_hooks.rb +57 -0
- data/lib/github/repos/repos_keys.rb +43 -0
- data/lib/github/repos/repos_watching.rb +33 -0
- data/lib/github/users/users.rb +34 -0
- data/lib/github/users/users_emails.rb +22 -0
- data/lib/github/users/users_followers.rb +31 -0
- data/lib/github/users/users_keys.rb +37 -0
- data/lib/rubhub.rb +38 -0
- data/test/test.rb +9 -0
- metadata +101 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
class IssuesComments
|
2
|
+
attr_accessor :github
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
end
|
7
|
+
|
8
|
+
def listIssueComments(repo, id, user=nil)
|
9
|
+
url = 'repos/%s/%s/issues/%s/comments' % [user, repo, id]
|
10
|
+
@github.get(url)
|
11
|
+
end
|
12
|
+
|
13
|
+
def getIssueComment(repo, id, user=nil)
|
14
|
+
url = 'repos/%s/%s/issues/comments/%s' % [user, repo, id]
|
15
|
+
@github.get(url)
|
16
|
+
end
|
17
|
+
|
18
|
+
def listIssues(repo, id, body, user=nil)
|
19
|
+
params = {
|
20
|
+
:body => body
|
21
|
+
}
|
22
|
+
data = params.to_json
|
23
|
+
url = 'repos/%s/%s/issues/%s/comments' % [user, repo, id]
|
24
|
+
@github.post(url, data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def editComment(repo, id, body, user=nil)
|
28
|
+
params = {
|
29
|
+
:body => body
|
30
|
+
}
|
31
|
+
data = params.to_json
|
32
|
+
url = 'repos/%s/%s/issues/comments/%s' % [user, repo, id]
|
33
|
+
@github.patch(url, data)
|
34
|
+
end
|
35
|
+
|
36
|
+
def deleteComment(repo, id, user=nil)
|
37
|
+
url = 'repos/%s/%s/issues/comments/%s' % [user, repo, id]
|
38
|
+
@github.delete(url)
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class IssuesEvents
|
2
|
+
attr_accessor :github
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
end
|
7
|
+
|
8
|
+
def listIssueEvents(repo, issue_id, user=nil)
|
9
|
+
url = 'repos/%s/%s/issues/%s/events' % [user, repo, issue_id]
|
10
|
+
@github.get(url)
|
11
|
+
end
|
12
|
+
|
13
|
+
def listRepoIssueEvents(repo, user=nil)
|
14
|
+
url = 'repos/%s/%s/issues/events' % [user, repo]
|
15
|
+
@github.get(url)
|
16
|
+
end
|
17
|
+
|
18
|
+
def getEvent(repo, id, user=nil)
|
19
|
+
url = 'repos/%s/%s/issues/events/%s' % [user, repo, id]
|
20
|
+
@github.get(url)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class IssuesLabels
|
2
|
+
attr_accessor :github
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
end
|
7
|
+
|
8
|
+
def listRepoLabels(repo, user=nil)
|
9
|
+
url = 'repos/%s/%s/labels' % [repo, user]
|
10
|
+
@github.get(url)
|
11
|
+
end
|
12
|
+
|
13
|
+
def getLabel(repo, id, user=nil)
|
14
|
+
url = 'repos/%s/%s/labels/%s' % [repo, user, id]
|
15
|
+
@github.get(url)
|
16
|
+
end
|
17
|
+
|
18
|
+
def createLabel(repo, name, color, user=nil)
|
19
|
+
params = {
|
20
|
+
:name => name,
|
21
|
+
:color => color
|
22
|
+
}
|
23
|
+
data = params.to_json
|
24
|
+
url = 'repos/%s/%s/labels' % [repo, user]
|
25
|
+
@github.post(url, data)
|
26
|
+
end
|
27
|
+
|
28
|
+
def editLabel(repo, id, name, color, user=nil)
|
29
|
+
params = {
|
30
|
+
:name => name,
|
31
|
+
:color => color
|
32
|
+
}
|
33
|
+
data = params.to_json
|
34
|
+
url = 'repos/%s/%s/labels/%s' % [repo, user, id]
|
35
|
+
@github.patch(url, data)
|
36
|
+
end
|
37
|
+
|
38
|
+
def deleteLabel(repo, id, user=nil)
|
39
|
+
url = 'repos/%s/%s/labels/%s' % [repo, user, id]
|
40
|
+
@github.delete(url)
|
41
|
+
end
|
42
|
+
|
43
|
+
def getIssueLabels(repo, id, user=nil)
|
44
|
+
url = 'repos/%s/%s/issues/%s/labels' % [repo, user, id]
|
45
|
+
@github.get(url)
|
46
|
+
end
|
47
|
+
|
48
|
+
def addIssueLabel(repo, id, labels, user=nil)
|
49
|
+
params = labels
|
50
|
+
data = params.to_json
|
51
|
+
url = 'repos/%s/%s/issues/%s/labels' % [repo, user, id]
|
52
|
+
@github.post(url, data)
|
53
|
+
end
|
54
|
+
|
55
|
+
def deleteIssueLabel(repo, issue_id, label_id, user=nil)
|
56
|
+
url = 'repos/%s/%s/issues/%s/labels/%s' % [repo, user, issue_id, label_id]
|
57
|
+
@github.delete(url)
|
58
|
+
end
|
59
|
+
|
60
|
+
def replaceIssueLabels(repo, id, labels, user=nil)
|
61
|
+
params = labels
|
62
|
+
data = params.to_json
|
63
|
+
url = 'repos/%s/%s/issues/%s/labels' % [repo, user, id]
|
64
|
+
@github.put(url, data)
|
65
|
+
end
|
66
|
+
|
67
|
+
def removeIssueLabels(repo, id, user=nil)
|
68
|
+
url = 'repos/%s/%s/issues/%s/labels' % [repo, user, id]
|
69
|
+
@github.delete(url)
|
70
|
+
end
|
71
|
+
|
72
|
+
def getIssueMilestoneLabels(repo, id, user=nil)
|
73
|
+
url = 'repos/%s/%s/milestones/%s/labels' % [repo, user, id]
|
74
|
+
@github.get(url)
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class IssuesMilestones
|
2
|
+
attr_accessor :github
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
end
|
7
|
+
|
8
|
+
def listRepoMilestones(repo, state=nil, sort=nil, direction=nil, user=nil)
|
9
|
+
params = {
|
10
|
+
:state => state,
|
11
|
+
:sort => sort,
|
12
|
+
:direction => direction,
|
13
|
+
}
|
14
|
+
params = @github.removeEmptyParams(params)
|
15
|
+
url = 'repos/%s/%s/milestones?%s' % [user, repo, @github.parameterize(params)]
|
16
|
+
@github.get(url)
|
17
|
+
end
|
18
|
+
|
19
|
+
def getMilestone(repo, number, user=nil)
|
20
|
+
url = 'repos/%s/%s/milestones/%s' % [repo, user, number]
|
21
|
+
@github.get(url)
|
22
|
+
end
|
23
|
+
|
24
|
+
def createMilestone(repo, title, state=nil, description=nil, due_on=nil, user=nil)
|
25
|
+
params = {
|
26
|
+
:title => title,
|
27
|
+
:state => state,
|
28
|
+
:description => description,
|
29
|
+
:due_on => due_on
|
30
|
+
}
|
31
|
+
params = @github.removeEmptyParams(params)
|
32
|
+
data = params.to_json
|
33
|
+
url = 'repos/%s/%s/milestones' % [repo, user]
|
34
|
+
@github.post(url, data)
|
35
|
+
end
|
36
|
+
|
37
|
+
def updateMilestone(repo, number, title, state=nil, description=nil, due_on=nil, user=nil)
|
38
|
+
params = {
|
39
|
+
:title => title,
|
40
|
+
:state => state,
|
41
|
+
:description => description,
|
42
|
+
:due_on => due_on
|
43
|
+
}
|
44
|
+
params = @github.removeEmptyParams(params)
|
45
|
+
data = params.to_json
|
46
|
+
url = 'repos/%s/%s/milestones/%s' % [repo, user, number]
|
47
|
+
@github.patch(url, data)
|
48
|
+
end
|
49
|
+
|
50
|
+
def deleteMilestone(repo, number, user=nil)
|
51
|
+
url = 'repos/%s/%s/milestones/%s' % [repo, user, number]
|
52
|
+
@github.delete(url)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Orgs
|
2
|
+
attr_accessor :github, :members, :teams
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
@members = OrgsMembers.new(github)
|
7
|
+
@teams = OrgsTeams.new(github)
|
8
|
+
end
|
9
|
+
|
10
|
+
def listOrgs(user=nil)
|
11
|
+
username = user == nil ? @github.username : user
|
12
|
+
url = user != @github.username ? 'users/%s/orgs' % username : 'user/orgs'
|
13
|
+
@github.get(url)
|
14
|
+
end
|
15
|
+
|
16
|
+
def getOrg(org)
|
17
|
+
@github.get('orgs/%s' % org)
|
18
|
+
end
|
19
|
+
|
20
|
+
def editOrg(org, billing_email=nil, company=nil, email=nil, location=nil, name=nil)
|
21
|
+
params = {
|
22
|
+
:billing_email => billing_email,
|
23
|
+
:company => company,
|
24
|
+
:email => email,
|
25
|
+
:location => location,
|
26
|
+
:name => name
|
27
|
+
}
|
28
|
+
params = @github.removeEmptyParams(params)
|
29
|
+
data = params.to_json
|
30
|
+
@github.patch('org/%s' % org, data)
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class OrgsMembers
|
2
|
+
attr_accessor :github
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
end
|
7
|
+
|
8
|
+
def listMembers(org)
|
9
|
+
@github.get('orgs/%s/members' % org)
|
10
|
+
end
|
11
|
+
|
12
|
+
def getMember(org, user=nil)
|
13
|
+
username = user == nil ? @github.username : user
|
14
|
+
@github.get('orgs/%s/members/%s' % [org, username])
|
15
|
+
end
|
16
|
+
|
17
|
+
def removeMember(org, user)
|
18
|
+
username = user == nil ? @github.username : user
|
19
|
+
@github.delete('orgs/%s/members/%s' % [org, username])
|
20
|
+
end
|
21
|
+
|
22
|
+
def listPublicMembers(org)
|
23
|
+
@github.get('orgs/%s/public_members' % org)
|
24
|
+
end
|
25
|
+
|
26
|
+
def getIfUserIsPublic(org, user)
|
27
|
+
username = user == nil ? @github.username : user
|
28
|
+
@github.get('orgs/%s/public_members/%s' % [org, username])
|
29
|
+
end
|
30
|
+
|
31
|
+
def publicizeUser(org, user)
|
32
|
+
username = user == nil ? @github.username : user
|
33
|
+
@github.put('orgs/%s/public_members/%s' % [org, username])
|
34
|
+
end
|
35
|
+
|
36
|
+
def concealUser(org, user)
|
37
|
+
username = user == nil ? @github.username : user
|
38
|
+
@github.delete('orgs/%s/public_members/%s' % [org, username])
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
class OrgsTeams
|
2
|
+
attr_accessor :github
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
end
|
7
|
+
|
8
|
+
def listTeams(org)
|
9
|
+
@github.get('orgs/%s/teams' % org)
|
10
|
+
end
|
11
|
+
|
12
|
+
def getTeam(id)
|
13
|
+
@github.get('teams/%s' % id)
|
14
|
+
end
|
15
|
+
|
16
|
+
def createTeam(org, name, repo_names=nil, permission=nil)
|
17
|
+
params = {
|
18
|
+
:name => name,
|
19
|
+
:repo_names => repo_names,
|
20
|
+
:permission => permission
|
21
|
+
}
|
22
|
+
params = @github.removeEmptyParams(params)
|
23
|
+
data = params.to_json
|
24
|
+
@github.post('orgs/%s/teams' % org, data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def editTeam(id, name, permission=nil)
|
28
|
+
params = {
|
29
|
+
:name => name,
|
30
|
+
:permission => permission
|
31
|
+
}
|
32
|
+
params = @github.removeEmptyParams(params)
|
33
|
+
data = params.to_json
|
34
|
+
@github.patch('teams/%s' % id, data)
|
35
|
+
end
|
36
|
+
|
37
|
+
def deleteTeam(id)
|
38
|
+
@github.delete('teams/%s' % id)
|
39
|
+
end
|
40
|
+
|
41
|
+
def listTeamMembers(id)
|
42
|
+
@github.get('teams/%s/members' % id)
|
43
|
+
end
|
44
|
+
|
45
|
+
def getTeamMember(id, user=nil)
|
46
|
+
username = user == nil ? @github.username : user
|
47
|
+
@github.get('teams/%s/members/%s' % [id, username])
|
48
|
+
end
|
49
|
+
|
50
|
+
def addTeamMember(id, user)
|
51
|
+
username = user == nil ? @github.username : user
|
52
|
+
@github.put('teams/%s/members/%s' % [id, username])
|
53
|
+
end
|
54
|
+
|
55
|
+
def deleteTeamMember(id, user)
|
56
|
+
username = user == nil ? @github.username : user
|
57
|
+
@github.delete('teams/%s/members/%s' % [id, username])
|
58
|
+
end
|
59
|
+
|
60
|
+
def listTeamRepos(id)
|
61
|
+
@github.get('teams/%s/repos' % id)
|
62
|
+
end
|
63
|
+
|
64
|
+
def getTeamRepo(id, user, repo)
|
65
|
+
username = user == nil ? @github.username : user
|
66
|
+
@github.get('teams/%s/repos/%s/%s' % [id, username, repo])
|
67
|
+
end
|
68
|
+
|
69
|
+
def addTeamRepo(id, user, repo)
|
70
|
+
username = user == nil ? @github.username : user
|
71
|
+
@github.put('teams/%s/repos/%s/%s' % [id, username, repo])
|
72
|
+
end
|
73
|
+
|
74
|
+
def removeTeamRepo(id, user, repo)
|
75
|
+
username = user == nil ? @github.username : user
|
76
|
+
@github.delete('teams/%s/repos/%s/%s' % [id, username, repo])
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class PullReq
|
2
|
+
attr_accessor :github, :reviewcomments
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
@reviewcomments = PullReviewComments.new(github)
|
7
|
+
end
|
8
|
+
|
9
|
+
def listPullRequests(repo, state=nil, user=nil)
|
10
|
+
username = user == nil ? @github.username : user
|
11
|
+
url = 'repos/%s/%s/pulls' % [username, repo]
|
12
|
+
url = '%s?%s' % state ? [url, @github.parameterize(state)] : url
|
13
|
+
@github.get(url)
|
14
|
+
end
|
15
|
+
|
16
|
+
def getPullRequest(repo, id, user=nil)
|
17
|
+
username = user == nil ? @github.username : user
|
18
|
+
@github.get(
|
19
|
+
'repos/%s/%s/pulls/%s' % [username, repo, id])
|
20
|
+
end
|
21
|
+
|
22
|
+
def createPullRequest(repo, title, base, head, body=nil, user=nil)
|
23
|
+
username = user == nil ? @github.username : user
|
24
|
+
params = {
|
25
|
+
:title => title,
|
26
|
+
:base => base,
|
27
|
+
:head => head,
|
28
|
+
:body => body
|
29
|
+
}
|
30
|
+
params = @github.removeEmptyParams(params)
|
31
|
+
data = params.to_json
|
32
|
+
@github.post('repos/%s/%s/pulls' % [username, repo], data)
|
33
|
+
end
|
34
|
+
|
35
|
+
def createPullRequestFromIssue(repo, issue, base, head, user=nil)
|
36
|
+
username = user == nil ? @github.username : user
|
37
|
+
params = {
|
38
|
+
:issue => issue,
|
39
|
+
:base => base,
|
40
|
+
:head => head
|
41
|
+
}
|
42
|
+
data = params.to_json
|
43
|
+
@github.post('repos/%s/%s/pulls' % [username, repo], data)
|
44
|
+
end
|
45
|
+
|
46
|
+
def listPullRequestCommits(repo, id, user=nil)
|
47
|
+
username = user == nil ? @github.username : user
|
48
|
+
@github.get(
|
49
|
+
'repos/%s/%s/pulls/%s/commits' % [username, repo, id])
|
50
|
+
end
|
51
|
+
|
52
|
+
def listPullRequestFiles(repo, id, user=nil)
|
53
|
+
username = user == nil ? @github.username : user
|
54
|
+
@github.get(
|
55
|
+
'repos/%s/%s/pulls/%s/files' % [username, repo, id])
|
56
|
+
end
|
57
|
+
|
58
|
+
def getIfPullRequestMerged(repo, id, user=nil)
|
59
|
+
username = user == nil ? @github.username : user
|
60
|
+
@github.get(
|
61
|
+
'repos/%s/%s/pulls/%s/merge' % [username, repo, id])
|
62
|
+
end
|
63
|
+
|
64
|
+
def mergePullRequest(repo, id, commit_message=nil, user=nil)
|
65
|
+
username = user == nil ? @github.username : user
|
66
|
+
if commit_message
|
67
|
+
params = {
|
68
|
+
:commit_message => commit_message
|
69
|
+
}
|
70
|
+
data = params.to_json
|
71
|
+
@github.put('repos/%s/%s/pulls/%s/merge' % [username, repo, id], data)
|
72
|
+
else
|
73
|
+
@github.put('repos/%s/%s/pulls/%s/merge' % [username, repo, id])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class PullReviewComments
|
2
|
+
attr_accessor :github
|
3
|
+
|
4
|
+
def initialize(github)
|
5
|
+
@github = github
|
6
|
+
end
|
7
|
+
|
8
|
+
def getComment(repo, id, user=nil)
|
9
|
+
username = user == nil ? @github.username : user
|
10
|
+
@github.get('repos/%s/%s/pulls/comments/%s' % [username, repo, id])
|
11
|
+
end
|
12
|
+
|
13
|
+
def listComments(repo, id, user=nil)
|
14
|
+
username = user == nil ? @github.username : user
|
15
|
+
@github.get('repos/%s/%s/pulls/%s/comments' % [username, repo, id])
|
16
|
+
end
|
17
|
+
|
18
|
+
def createComment(repo, id, body, commit_id, path, position, user=nil)
|
19
|
+
username = user == nil ? @github.username : user
|
20
|
+
params = {
|
21
|
+
:body => body,
|
22
|
+
:commit_id => commit_id,
|
23
|
+
:path => path,
|
24
|
+
:position => position
|
25
|
+
}
|
26
|
+
data = params.to_json
|
27
|
+
@github.post('repos/%s/%s/pulls/%s/comments' % [username, repo, id], data)
|
28
|
+
end
|
29
|
+
|
30
|
+
def createCommentResponse(repo, id, body, in_reply_to, user=nil)
|
31
|
+
username = user == nil ? @github.username : user
|
32
|
+
params = {
|
33
|
+
:body => body,
|
34
|
+
:in_reply_to => in_reply_to
|
35
|
+
}
|
36
|
+
data = params.to_json
|
37
|
+
@github.post('repos/%s/%s/pulls/%s/comments' % [username, repo, id], data)
|
38
|
+
end
|
39
|
+
|
40
|
+
def editComment(repo, id, body, user=nil)
|
41
|
+
username = user == nil ? @github.username : user
|
42
|
+
params = {
|
43
|
+
:body => body
|
44
|
+
}
|
45
|
+
data = params.to_json
|
46
|
+
@github.patch('repos/%s/%s/pulls/comments/%s' % [username, repo, id], data)
|
47
|
+
end
|
48
|
+
|
49
|
+
def deleteComment(repo, id, user=nil)
|
50
|
+
username = user == nil ? @github.username : user
|
51
|
+
@github.delete('repos/%s/%s/pulls/comments/%s' % [username, repo, id])
|
52
|
+
end
|
53
|
+
end
|