forked from sigmike/peer4commit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.rb
More file actions
30 lines (25 loc) · 642 Bytes
/
github.rb
File metadata and controls
30 lines (25 loc) · 642 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Github
def initialize
@client = Octokit::Client.new(
:client_id => CONFIG['github']['key'],
:client_secret => CONFIG['github']['secret'],
:per_page => 100)
end
attr_reader :client
def commits project
client.commits project.full_name
end
def repository_info project
if project.github_id.present?
client.get "/repositories/#{project.github_id}"
else
client.repo full_name
end
end
def repository_url project
"https://github.com/#{project.full_name}"
end
def source_repository_url project
"https://github.com/#{project.source_full_name}"
end
end