-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrubyExamples.rb
65 lines (49 loc) · 1.4 KB
/
rubyExamples.rb
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
require 'octokit'
class Summerizr
def take_userlogin
user_flag = false
@username = nil
@password = nil
f = File.open("user-login.txt","r")
f.each_line do |line|
if !user_flag
@username = line
user_flag = true
else
@password = line
end
end
return @username, @password
end
def login_client
#Provide authentication credentials
Octokit.configure do |c|
c.login = u
c.password = p
end
# Fetch the current user
curr_user = Octokit.user
puts 'before'
repo = Octokit.repo 'Original-heapsters/git-Summerizr'
rel = repo.rels[:issues]
obj = rel.get(:uri => {:number => 1}).data
obj.each do |x| puts x end
#curr_user.fields.each do |name|
# id = ":#{name}"
# puts id.to_str
# if id.to_str == ":repos_url"
# puts id
# info = curr_user.rels[id].get.data
# puts info
# end
#end
puts 'after'
end
end
test1 = Summerizr.new
test1.login_client
u,p =test1.take_userlogin
puts u
puts p