rubhub 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/README.md +123 -138
- data/lib/github/events/events.rb +2 -1
- data/lib/github/github.rb +8 -8
- data/lib/github/repos/repos.rb +2 -1
- data/lib/github/users/users_emails.rb +1 -0
- data/lib/rubhub.rb +0 -1
- metadata +25 -14
- data/test/test.rb +0 -16
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
YThkNWEyNmJkOWZkYjdmM2FlMDVjZjQzMWNhYTFiMWUxMGNmYTBlOTE4ZDM5
|
10
|
-
MDI5MmNmZDU0ZTI4MWM4Mzc4MGRiYmIyMWRiYzMxYzE1MWNiMjdhODI2ODkw
|
11
|
-
MGRjMjA5M2MzMjU4N2ExYTM1OWIxNTcxNzJiYzY2MzdhMjNkZTI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZDU1NWM4MWM1YjZmZGI5NmFmYjM0MzZhNjZmMzdiYThiYTgyNmFkZDNhMzhk
|
14
|
-
NDk0OTBlOWU3Y2JiYmFiYzZiYTVlYzY2OGVkOTNlNmE3Mzk4NTBlY2M0N2Fi
|
15
|
-
NjczMjFhMTAxOThiYTY2YjY2MjVjNWIwOTI0MzkzZGNkZTIyZGE=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 78f3b84cda8d4b2ceeba44d022895e3ba66e48d0
|
4
|
+
data.tar.gz: ec527756f026430c7f7b28da31883459b49933f5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a47e3e1002f147a4606d76b46106cab8bbc31e22ee20339a065af968c24fb28e0a3052553dc33cb1a19b1bdef347e2920a89bc2f8b9f98d0ac6034ab6d0febc
|
7
|
+
data.tar.gz: 04e35f0657181617640b214d7a8b76f8d164641c1d2bc9271d790ce7304f060d64da3182f09ec922717071bb4a8f48af4e1c9a2f73b600743413043e13be4b9b
|
data/README.md
CHANGED
@@ -1,139 +1,124 @@
|
|
1
|
-
*Github API
|
2
|
-
=================================================
|
3
|
-
-------------------------------------------------
|
4
|
-
A minimal Ruby
|
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
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
"
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
"
|
111
|
-
"
|
112
|
-
"
|
113
|
-
"
|
114
|
-
"
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
"url": "https://api.github.com/users/username",
|
125
|
-
"avatar_url": "https://secure.gravatar.com/avatar/someimage.png",
|
126
|
-
"gravatar_id": "948f18791231231231231231231",
|
127
|
-
"login": "username",
|
128
|
-
"id": 901650
|
129
|
-
},
|
130
|
-
"name": "Example",
|
131
|
-
"open_issues": 0,
|
132
|
-
"master_branch": null,
|
133
|
-
"pushed_at": null,
|
134
|
-
"id": 3436770,
|
135
|
-
"git_url": "git://github.com/username/Example.git",
|
136
|
-
"language": null
|
137
|
-
}
|
138
|
-
}
|
1
|
+
*rubhub - Ruby Gem for the Github API*
|
2
|
+
=================================================
|
3
|
+
-------------------------------------------------
|
4
|
+
A minimal Ruby Gem created for making interaction with the Github API(v3) easy and predictable.
|
5
|
+
|
6
|
+
http://developer.github.com/v3/
|
7
|
+
|
8
|
+
*Installation*
|
9
|
+
-------------------------------------------------
|
10
|
+
<pre>
|
11
|
+
gem install rubhub
|
12
|
+
</pre>
|
13
|
+
|
14
|
+
*Basic Authentication*
|
15
|
+
-------------------------------------------------
|
16
|
+
Use a username and password associated with a Github account.
|
17
|
+
|
18
|
+
Example:
|
19
|
+
<pre>
|
20
|
+
require 'rubhub'
|
21
|
+
g = Github.new( username, password )
|
22
|
+
</pre>
|
23
|
+
|
24
|
+
*Making Requests*
|
25
|
+
=================================================
|
26
|
+
-------------------------------------------------
|
27
|
+
Use the API documentation as a reference. The library is structured exactly like the API v3 documentation.
|
28
|
+
|
29
|
+
*Example Request for Authenticated User's Data*
|
30
|
+
-------------------------------------------------
|
31
|
+
<pre>
|
32
|
+
response = g.users.getUser()
|
33
|
+
</pre>
|
34
|
+
<h4>The response...</h4>
|
35
|
+
<pre>
|
36
|
+
{
|
37
|
+
"type": "User",
|
38
|
+
"url": "https://api.github.com/users/username",
|
39
|
+
"private_gists": 2,
|
40
|
+
"created_at": "2011-07-07T22:20:48Z",
|
41
|
+
"email": "example@gmail.com",
|
42
|
+
"html_url": "https://github.com/username",
|
43
|
+
"gravatar_id": "123123123123123123123123123",
|
44
|
+
"collaborators": 1,
|
45
|
+
"hireable": false,
|
46
|
+
"disk_usage": 13348,
|
47
|
+
"total_private_repos": 3,
|
48
|
+
"following": 4,
|
49
|
+
"blog": "http://www.yoursitename.com/",
|
50
|
+
"bio": null,
|
51
|
+
"avatar_url": "https://www.avatar.com/pathtoyouravatar.png",
|
52
|
+
"login": "username",
|
53
|
+
"owned_private_repos": 3,
|
54
|
+
"followers": 1,
|
55
|
+
"name": "Your Name",
|
56
|
+
"plan": {
|
57
|
+
"private_repos": 10,
|
58
|
+
"collaborators": 3,
|
59
|
+
"space": 614400,
|
60
|
+
"name": "micro"
|
61
|
+
},
|
62
|
+
"location": "Your City, NY",
|
63
|
+
"id": 902312,
|
64
|
+
"public_repos": 0,
|
65
|
+
"public_gists": 17,
|
66
|
+
"company": "Your Company Name, LLC"
|
67
|
+
}
|
68
|
+
</pre>
|
69
|
+
|
70
|
+
|
71
|
+
*Example Request Creating a New Repository*
|
72
|
+
-------------------------------------------------
|
73
|
+
<pre>
|
74
|
+
# Using just the new Repo name
|
75
|
+
response = g.repos.createUserRepo( "MyNewRepo" )
|
76
|
+
|
77
|
+
# Using some other parameters
|
78
|
+
name = 'MyNewRepo'
|
79
|
+
desc = 'Some description.'
|
80
|
+
page = 'www.homepage.com'
|
81
|
+
private = TRUE
|
82
|
+
has_issues = TRUE
|
83
|
+
has_wiki = TRUE
|
84
|
+
has_downloads = TRUE
|
85
|
+
response = g.repos.createUserRepo( name, desc, page, private, has_issues, has_wiki, has_downloads )
|
86
|
+
</pre>
|
87
|
+
|
88
|
+
<h4>The response...</h4>
|
89
|
+
<pre>
|
90
|
+
{
|
91
|
+
"url": "https://api.github.com/repos/username/MyNewRepo",
|
92
|
+
"watchers": 1,
|
93
|
+
"has_issues": true,
|
94
|
+
"created_at": "2012-02-14T03:40:49Z",
|
95
|
+
"html_url": "https://github.com/username/MyNewRepo",
|
96
|
+
"has_downloads": true,
|
97
|
+
"ssh_url": "git@github.com:username/MyNewRepo.git",
|
98
|
+
"svn_url": "https://github.com/username/MyNewRepo",
|
99
|
+
"description": "Some description.",
|
100
|
+
"mirror_url": null,
|
101
|
+
"clone_url": "https://github.com/username/MyNewRepo.git",
|
102
|
+
"forks": 1,
|
103
|
+
"fork": false,
|
104
|
+
"has_wiki": true,
|
105
|
+
"private": True,
|
106
|
+
"homepage": "www.homepage.com",
|
107
|
+
"size": 0,
|
108
|
+
"updated_at": "2012-02-14T03:40:49Z",
|
109
|
+
"owner": {
|
110
|
+
"url": "https://api.github.com/users/username",
|
111
|
+
"avatar_url": "https://secure.gravatar.com/avatar/someimage.png",
|
112
|
+
"gravatar_id": "948f18791231231231231231231",
|
113
|
+
"login": "username",
|
114
|
+
"id": 901650
|
115
|
+
},
|
116
|
+
"name": "MyNewRepo",
|
117
|
+
"open_issues": 0,
|
118
|
+
"master_branch": null,
|
119
|
+
"pushed_at": null,
|
120
|
+
"id": 3436770,
|
121
|
+
"git_url": "git://github.com/username/MyNewRepo.git",
|
122
|
+
"language": null
|
123
|
+
}
|
139
124
|
</pre>
|
data/lib/github/events/events.rb
CHANGED
data/lib/github/github.rb
CHANGED
@@ -3,7 +3,7 @@ class Github
|
|
3
3
|
attr_accessor :events, :gists, :gitdata, :issues, :orgs, :pullreqs, :repos, :users
|
4
4
|
|
5
5
|
def initialize(username, password)
|
6
|
-
@apiurl = 'api.github.com'
|
6
|
+
@apiurl = 'https://api.github.com'
|
7
7
|
@username = username
|
8
8
|
@password = password
|
9
9
|
@events = Events.new(self)
|
@@ -21,7 +21,7 @@ class Github
|
|
21
21
|
uri = URI(buildurl(path))
|
22
22
|
req = Net::HTTP::Head.new(uri.request_uri)
|
23
23
|
req.basic_auth @username, @password
|
24
|
-
res = Net::HTTP.start(
|
24
|
+
res = Net::HTTP.start(uri.hostname, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http|
|
25
25
|
http.request(req)
|
26
26
|
}
|
27
27
|
JSON.parse(res.body)
|
@@ -31,7 +31,7 @@ class Github
|
|
31
31
|
uri = URI(buildurl(path))
|
32
32
|
req = Net::HTTP::Get.new(uri.request_uri)
|
33
33
|
req.basic_auth @username, @password
|
34
|
-
res = Net::HTTP.start(
|
34
|
+
res = Net::HTTP.start(uri.hostname, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http|
|
35
35
|
http.request(req)
|
36
36
|
}
|
37
37
|
JSON.parse(res.body)
|
@@ -42,7 +42,7 @@ class Github
|
|
42
42
|
req = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})
|
43
43
|
req.basic_auth @username, @password
|
44
44
|
req.body = data
|
45
|
-
res = Net::HTTP.start(
|
45
|
+
res = Net::HTTP.start(uri.hostname, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http|
|
46
46
|
http.request(req)
|
47
47
|
}
|
48
48
|
res.body
|
@@ -53,7 +53,7 @@ class Github
|
|
53
53
|
req = Net::HTTP::Patch.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})
|
54
54
|
req.basic_auth @username, @password
|
55
55
|
req.body = data
|
56
|
-
res = Net::HTTP.start(
|
56
|
+
res = Net::HTTP.start(uri.hostname, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http|
|
57
57
|
http.request(req)
|
58
58
|
}
|
59
59
|
JSON.parse(res.body)
|
@@ -64,7 +64,7 @@ class Github
|
|
64
64
|
req = Net::HTTP::Put.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})
|
65
65
|
req.basic_auth @username, @password
|
66
66
|
req.body = data
|
67
|
-
res = Net::HTTP.start(
|
67
|
+
res = Net::HTTP.start(uri.hostname, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http|
|
68
68
|
http.request(req)
|
69
69
|
}
|
70
70
|
JSON.parse(res.body)
|
@@ -75,14 +75,14 @@ class Github
|
|
75
75
|
req = Net::HTTP::Delete.new(uri.request_uri)
|
76
76
|
req.basic_auth @username, @password
|
77
77
|
req.body = data
|
78
|
-
res = Net::HTTP.start(
|
78
|
+
res = Net::HTTP.start(uri.hostname, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http|
|
79
79
|
http.request(req)
|
80
80
|
}
|
81
81
|
res.body ? JSON.parse(res.body) : res.code
|
82
82
|
end
|
83
83
|
|
84
84
|
def buildurl(path)
|
85
|
-
|
85
|
+
@apiurl + ((path[0] == '/') ? path : ('/%s' % path))
|
86
86
|
end
|
87
87
|
|
88
88
|
def parameterize(params)
|
data/lib/github/repos/repos.rb
CHANGED
@@ -13,7 +13,8 @@ class Repos
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def listRepos(user=nil)
|
16
|
-
|
16
|
+
username = user == nil ? @github.username : user
|
17
|
+
url = 'users/%s/repos' % user != @github.username ? username : 'user/repos'
|
17
18
|
@github.get(url)
|
18
19
|
end
|
19
20
|
|
data/lib/rubhub.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,53 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubhub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Kennedy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.7'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.7.7
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.7'
|
30
|
+
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
32
|
+
version: 1.7.7
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rest-client
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.6'
|
40
|
+
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
33
42
|
version: 1.6.7
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.6'
|
50
|
+
- - ">="
|
39
51
|
- !ruby/object:Gem::Version
|
40
52
|
version: 1.6.7
|
41
53
|
description: An intuitive wrapper for the Github Api v3.
|
@@ -45,8 +57,6 @@ extensions: []
|
|
45
57
|
extra_rdoc_files: []
|
46
58
|
files:
|
47
59
|
- README.md
|
48
|
-
- lib/rubhub.rb
|
49
|
-
- lib/github/github.rb
|
50
60
|
- lib/github/events/events.rb
|
51
61
|
- lib/github/gists/gists.rb
|
52
62
|
- lib/github/gists/gists_comments.rb
|
@@ -56,6 +66,7 @@ files:
|
|
56
66
|
- lib/github/gitdata/gitdata_references.rb
|
57
67
|
- lib/github/gitdata/gitdata_tags.rb
|
58
68
|
- lib/github/gitdata/gitdata_trees.rb
|
69
|
+
- lib/github/github.rb
|
59
70
|
- lib/github/issues/issues.rb
|
60
71
|
- lib/github/issues/issues_comments.rb
|
61
72
|
- lib/github/issues/issues_events.rb
|
@@ -78,7 +89,7 @@ files:
|
|
78
89
|
- lib/github/users/users_emails.rb
|
79
90
|
- lib/github/users/users_followers.rb
|
80
91
|
- lib/github/users/users_keys.rb
|
81
|
-
-
|
92
|
+
- lib/rubhub.rb
|
82
93
|
homepage: http://rubygems.org/gems/rubhub
|
83
94
|
licenses: []
|
84
95
|
metadata: {}
|
@@ -88,17 +99,17 @@ require_paths:
|
|
88
99
|
- lib
|
89
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
90
101
|
requirements:
|
91
|
-
- -
|
102
|
+
- - ">="
|
92
103
|
- !ruby/object:Gem::Version
|
93
104
|
version: '0'
|
94
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
106
|
requirements:
|
96
|
-
- -
|
107
|
+
- - ">="
|
97
108
|
- !ruby/object:Gem::Version
|
98
109
|
version: '0'
|
99
110
|
requirements: []
|
100
111
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.4.1
|
102
113
|
signing_key:
|
103
114
|
specification_version: 4
|
104
115
|
summary: Intuitive wrapper for the Github Api v3.
|
data/test/test.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'rubhub'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
username = 'csphere'
|
5
|
-
password = 'Asdf1597531`1'
|
6
|
-
|
7
|
-
g = Github.new(username, password)
|
8
|
-
gistData = g.gists.listGists()
|
9
|
-
|
10
|
-
for i in (0..gistData.length - 1)
|
11
|
-
id = gistData[i]['id']
|
12
|
-
puts 'Deleting gist [ %s ] ' % id
|
13
|
-
g.gists.deleteGist(id)
|
14
|
-
end
|
15
|
-
|
16
|
-
puts "Done! :D\n\n"
|