hubruby 0.0.2 → 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.rdoc +6 -4
- data/Rakefile +1 -1
- data/lib/github/finders.rb +16 -16
- data/lib/github/models/user.rb +6 -6
- metadata +4 -7
- data/History.txt +0 -6
- data/Manifest.txt +0 -14
data/README.rdoc
CHANGED
@@ -4,19 +4,21 @@
|
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
|
7
|
+
A simple Ruby library for accessing the current GitHub API (v2).
|
8
8
|
|
9
9
|
== SYNOPSIS:
|
10
10
|
|
11
|
-
|
11
|
+
user = GitHub.user('diogenes')
|
12
|
+
user.repositories
|
13
|
+
user.following
|
12
14
|
|
13
15
|
== REQUIREMENTS:
|
14
16
|
|
15
|
-
*
|
17
|
+
* httparty
|
16
18
|
|
17
19
|
== INSTALL:
|
18
20
|
|
19
|
-
|
21
|
+
sudo gem install hubruby
|
20
22
|
|
21
23
|
== LICENSE:
|
22
24
|
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ $hoe = Hoe.spec 'hubruby' do
|
|
14
14
|
self.developer 'Diógenes Falcão', 'diogenes {d-o-t} araujo {at} gmail.com'
|
15
15
|
self.rubyforge_name = self.name
|
16
16
|
self.extra_deps = [['httparty','= 0.6.1']]
|
17
|
-
self.version = '0.0.
|
17
|
+
self.version = '0.0.3'
|
18
18
|
end
|
19
19
|
|
20
20
|
require 'newgem/tasks'
|
data/lib/github/finders.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
module GitHub
|
2
2
|
module Finders
|
3
|
-
def user(
|
4
|
-
j = json("/user/show/#{
|
3
|
+
def user(login)
|
4
|
+
j = json("/user/show/#{login}", :user)
|
5
5
|
User.from_json(j)
|
6
6
|
end
|
7
7
|
|
8
|
-
def following(
|
9
|
-
j = json("/user/show/#{
|
8
|
+
def following(login)
|
9
|
+
j = json("/user/show/#{login}/following", :users)
|
10
10
|
User.users_from_json(j)
|
11
11
|
end
|
12
12
|
|
13
|
-
def followers(
|
14
|
-
j = json("/user/show/#{
|
13
|
+
def followers(login)
|
14
|
+
j = json("/user/show/#{login}/followers", :users)
|
15
15
|
User.users_from_json(j)
|
16
16
|
end
|
17
17
|
|
18
|
-
def repositories(
|
19
|
-
j = json("/repos/show/#{
|
18
|
+
def repositories(login)
|
19
|
+
j = json("/repos/show/#{login}", :repositories)
|
20
20
|
Repository.repositories_from_json(j)
|
21
21
|
end
|
22
22
|
|
23
|
-
def watched(
|
24
|
-
j = json("/repos/watched/#{
|
23
|
+
def watched(login)
|
24
|
+
j = json("/repos/watched/#{login}", :repositories)
|
25
25
|
Repository.repositories_from_json(j)
|
26
26
|
end
|
27
27
|
|
28
|
-
def repository(
|
29
|
-
j = json("/repos/show/#{
|
28
|
+
def repository(login, repository_name)
|
29
|
+
j = json("/repos/show/#{login}/#{repository_name}", :repository)
|
30
30
|
Repository.from_json(j)
|
31
31
|
end
|
32
32
|
|
33
|
-
def branches(
|
34
|
-
json("/repos/show/#{
|
33
|
+
def branches(login, repository_name)
|
34
|
+
json("/repos/show/#{login}/#{repository_name}/branches", :branches)
|
35
35
|
end
|
36
36
|
|
37
|
-
def network(
|
38
|
-
j = json("/repos/show/#{
|
37
|
+
def network(login, repository_name)
|
38
|
+
j = json("/repos/show/#{login}/#{repository_name}/network", :network)
|
39
39
|
Repository.repositories_from_json(j)
|
40
40
|
end
|
41
41
|
|
data/lib/github/models/user.rb
CHANGED
@@ -7,25 +7,25 @@ module GitHub
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.users_from_json(json)
|
10
|
-
json.inject([]) do |users,
|
11
|
-
users << from_json(:
|
10
|
+
json.inject([]) do |users, login|
|
11
|
+
users << from_json(:login => login)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def following
|
16
|
-
@following ||= GitHub.following(self.
|
16
|
+
@following ||= GitHub.following(self.login)
|
17
17
|
end
|
18
18
|
|
19
19
|
def followers
|
20
|
-
@followers ||= GitHub.followers(self.
|
20
|
+
@followers ||= GitHub.followers(self.login)
|
21
21
|
end
|
22
22
|
|
23
23
|
def repositories
|
24
|
-
@repositories ||= GitHub.repositories(self.
|
24
|
+
@repositories ||= GitHub.repositories(self.login)
|
25
25
|
end
|
26
26
|
|
27
27
|
def watched
|
28
|
-
@watched ||= GitHub.watched(self.
|
28
|
+
@watched ||= GitHub.watched(self.login)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Di\xC3\xB3genes Falc\xC3\xA3o"
|
@@ -66,12 +66,9 @@ executables: []
|
|
66
66
|
|
67
67
|
extensions: []
|
68
68
|
|
69
|
-
extra_rdoc_files:
|
70
|
-
|
71
|
-
- Manifest.txt
|
69
|
+
extra_rdoc_files: []
|
70
|
+
|
72
71
|
files:
|
73
|
-
- History.txt
|
74
|
-
- Manifest.txt
|
75
72
|
- README.rdoc
|
76
73
|
- Rakefile
|
77
74
|
- TODO
|
data/History.txt
DELETED
data/Manifest.txt
DELETED