rubhub 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +139 -0
- data/lib/github/events/events.rb +1 -2
- data/lib/github/github.rb +8 -8
- data/lib/github/repos/repos.rb +1 -1
- data/lib/github/users/users_emails.rb +0 -1
- data/test/test.rb +9 -2
- metadata +17 -13
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDIwNDVmYjMxM2U3OWZlMDk2Zjk4MWQwZDAyMGJhYmJkNGY3OTgxZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZGY0OTc0MGU2ZmEzNDE4OTQxYjdkNjM0MjI1NGY1MTk4NDNhYjVmZg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YThkNWEyNmJkOWZkYjdmM2FlMDVjZjQzMWNhYTFiMWUxMGNmYTBlOTE4ZDM5
|
10
|
+
MDI5MmNmZDU0ZTI4MWM4Mzc4MGRiYmIyMWRiYzMxYzE1MWNiMjdhODI2ODkw
|
11
|
+
MGRjMjA5M2MzMjU4N2ExYTM1OWIxNTcxNzJiYzY2MzdhMjNkZTI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDU1NWM4MWM1YjZmZGI5NmFmYjM0MzZhNjZmMzdiYThiYTgyNmFkZDNhMzhk
|
14
|
+
NDk0OTBlOWU3Y2JiYmFiYzZiYTVlYzY2OGVkOTNlNmE3Mzk4NTBlY2M0N2Fi
|
15
|
+
NjczMjFhMTAxOThiYTY2YjY2MjVjNWIwOTI0MzkzZGNkZTIyZGE=
|
data/README.md
CHANGED
@@ -0,0 +1,139 @@
|
|
1
|
+
*Github API Wrapper*
|
2
|
+
=================================================
|
3
|
+
-------------------------------------------------
|
4
|
+
A minimal Ruby gem created for making interaction
|
5
|
+
with the Github API(v3) easy and predictable.
|
6
|
+
|
7
|
+
http://developer.github.com/v3/
|
8
|
+
|
9
|
+
*Basic Authentication*
|
10
|
+
-------------------------------------------------
|
11
|
+
Example authentication:
|
12
|
+
<pre>
|
13
|
+
require 'rubhub'
|
14
|
+
|
15
|
+
g = Github.new('usernamehere','passwordhere')
|
16
|
+
</pre>
|
17
|
+
|
18
|
+
*Making Requests*
|
19
|
+
=================================================
|
20
|
+
-------------------------------------------------
|
21
|
+
|
22
|
+
*Example Request for Authenticated User's Data*
|
23
|
+
-------------------------------------------------
|
24
|
+
<pre>
|
25
|
+
response = g.users.getUser()
|
26
|
+
</pre>
|
27
|
+
<h4>The response...</h4>
|
28
|
+
<pre>
|
29
|
+
{
|
30
|
+
"type": "User",
|
31
|
+
"url": "https://api.github.com/users/username",
|
32
|
+
"private_gists": 2,
|
33
|
+
"created_at": "2011-07-07T22:20:48Z",
|
34
|
+
"email": "example@gmail.com",
|
35
|
+
"html_url": "https://github.com/username",
|
36
|
+
"gravatar_id": "123123123123123123123123123",
|
37
|
+
"collaborators": 1,
|
38
|
+
"hireable": false,
|
39
|
+
"disk_usage": 13348,
|
40
|
+
"total_private_repos": 3,
|
41
|
+
"following": 4,
|
42
|
+
"blog": "http://www.yoursitename.com/",
|
43
|
+
"bio": null,
|
44
|
+
"avatar_url": "https://www.avatar.com/pathtoyouravatar.png",
|
45
|
+
"login": "username",
|
46
|
+
"owned_private_repos": 3,
|
47
|
+
"followers": 1,
|
48
|
+
"name": "Your Name",
|
49
|
+
"plan": {
|
50
|
+
"private_repos": 10,
|
51
|
+
"collaborators": 3,
|
52
|
+
"space": 614400,
|
53
|
+
"name": "micro"
|
54
|
+
},
|
55
|
+
"location": "Your City, NY",
|
56
|
+
"id": 902312,
|
57
|
+
"public_repos": 0,
|
58
|
+
"public_gists": 17,
|
59
|
+
"company": "Your Company Name, LLC"
|
60
|
+
}
|
61
|
+
</pre>
|
62
|
+
|
63
|
+
*Example Request Creating a New Repository*
|
64
|
+
-------------------------------------------------
|
65
|
+
<pre>
|
66
|
+
g.repos.createRepo(
|
67
|
+
name => $repoName, // required
|
68
|
+
description => $repoDescription, // optional
|
69
|
+
homepage => $repoHomePage, // optional
|
70
|
+
private => $repoPrivacy // optional
|
71
|
+
has_issues => $repoIssuesEnabled // optional
|
72
|
+
has_wiki => $repoWikiEnabled // optional
|
73
|
+
has_downloads=> $repoDownloadsEnabled // optional
|
74
|
+
team_id => $collabTeamID // optional
|
75
|
+
)
|
76
|
+
$response = $github->executeRequest('POST','user/repos',$query);
|
77
|
+
</pre>
|
78
|
+
|
79
|
+
<h4>The response...</h4>
|
80
|
+
<pre>
|
81
|
+
{
|
82
|
+
"headers": {
|
83
|
+
"url": "https://api.github.com/user/repos?access_token=[YOUR_TOKEN]",
|
84
|
+
"content_type": "application/json; charset=utf-8",
|
85
|
+
"http_code": 201,
|
86
|
+
"header_size": 413,
|
87
|
+
"request_size": 358,
|
88
|
+
"filetime": -1,
|
89
|
+
"ssl_verify_result": 0,
|
90
|
+
"redirect_count": 0,
|
91
|
+
"total_time": 0.280588,
|
92
|
+
"namelookup_time": 0.014798,
|
93
|
+
"connect_time": 0.023159,
|
94
|
+
"pretransfer_time": 0.065582,
|
95
|
+
"size_upload": 170,
|
96
|
+
"size_download": 975,
|
97
|
+
"speed_download": 3474,
|
98
|
+
"speed_upload": 605,
|
99
|
+
"download_content_length": 975,
|
100
|
+
"upload_content_length": 170,
|
101
|
+
"starttransfer_time": 0.280533,
|
102
|
+
"redirect_time": 0
|
103
|
+
},
|
104
|
+
"response": {
|
105
|
+
"url": "https://api.github.com/repos/username/Example",
|
106
|
+
"watchers": 1,
|
107
|
+
"has_issues": true,
|
108
|
+
"created_at": "2012-02-14T03:40:49Z",
|
109
|
+
"html_url": "https://github.com/username/Example",
|
110
|
+
"has_downloads": true,
|
111
|
+
"ssh_url": "git@github.com:username/Example.git",
|
112
|
+
"svn_url": "https://github.com/username/Example",
|
113
|
+
"description": "ExampleDescription",
|
114
|
+
"mirror_url": null,
|
115
|
+
"clone_url": "https://github.com/username/Example.git",
|
116
|
+
"forks": 1,
|
117
|
+
"fork": false,
|
118
|
+
"has_wiki": true,
|
119
|
+
"private": false,
|
120
|
+
"homepage": "www.examplepage.com",
|
121
|
+
"size": 0,
|
122
|
+
"updated_at": "2012-02-14T03:40:49Z",
|
123
|
+
"owner": {
|
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
|
+
}
|
139
|
+
</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 = '
|
6
|
+
@apiurl = '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('api.github.com', use_ssl
|
24
|
+
res = Net::HTTP.start('api.github.com', 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('api.github.com', use_ssl
|
34
|
+
res = Net::HTTP.start('api.github.com', 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('api.github.com', use_ssl
|
45
|
+
res = Net::HTTP.start('api.github.com', 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('api.github.com', use_ssl
|
56
|
+
res = Net::HTTP.start('api.github.com', 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('api.github.com', use_ssl
|
67
|
+
res = Net::HTTP.start('api.github.com', 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('api.github.com', use_ssl
|
78
|
+
res = Net::HTTP.start('api.github.com', 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
|
-
@apiurl + ((path[0] == '/') ? path : ('/%s' % path))
|
85
|
+
'https://' + @apiurl + ((path[0] == '/') ? path : ('/%s' % path))
|
86
86
|
end
|
87
87
|
|
88
88
|
def parameterize(params)
|
data/lib/github/repos/repos.rb
CHANGED
data/test/test.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
2
1
|
require 'rubhub'
|
2
|
+
require 'json'
|
3
3
|
|
4
4
|
username = 'csphere'
|
5
5
|
password = 'Asdf1597531`1'
|
6
6
|
|
7
7
|
g = Github.new(username, password)
|
8
|
+
gistData = g.gists.listGists()
|
8
9
|
|
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"
|
metadata
CHANGED
@@ -1,38 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubhub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sean Kennedy
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: json
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.5.4
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.5.4
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rest-client
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 1.6.7
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.6.7
|
36
41
|
description: An intuitive wrapper for the Github Api v3.
|
37
42
|
email: cspheregreen@gmail.com
|
38
43
|
executables: []
|
@@ -76,26 +81,25 @@ files:
|
|
76
81
|
- test/test.rb
|
77
82
|
homepage: http://rubygems.org/gems/rubhub
|
78
83
|
licenses: []
|
84
|
+
metadata: {}
|
79
85
|
post_install_message:
|
80
86
|
rdoc_options: []
|
81
87
|
require_paths:
|
82
88
|
- lib
|
83
89
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
90
|
requirements:
|
86
91
|
- - ! '>='
|
87
92
|
- !ruby/object:Gem::Version
|
88
93
|
version: '0'
|
89
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
95
|
requirements:
|
92
96
|
- - ! '>='
|
93
97
|
- !ruby/object:Gem::Version
|
94
98
|
version: '0'
|
95
99
|
requirements: []
|
96
100
|
rubyforge_project:
|
97
|
-
rubygems_version:
|
101
|
+
rubygems_version: 2.0.3
|
98
102
|
signing_key:
|
99
|
-
specification_version:
|
103
|
+
specification_version: 4
|
100
104
|
summary: Intuitive wrapper for the Github Api v3.
|
101
105
|
test_files: []
|