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 CHANGED
@@ -1,15 +1,7 @@
1
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=
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 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
- }
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>
@@ -39,6 +39,7 @@ class Events
39
39
  end
40
40
 
41
41
  def listOrgEvents(org)
42
- @github.get('users/%s/events/orgs/%s' % [@github.username, org])
42
+ username = @github.username
43
+ @github.get('users/%s/events/orgs/%s' % [username, org])
43
44
  end
44
45
  end
@@ -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('api.github.com', use_ssl => true, verify_mode => OpenSSL::SSL::VERIFY_NONE) { |http|
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('api.github.com', use_ssl => true, verify_mode => OpenSSL::SSL::VERIFY_NONE) { |http|
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('api.github.com', use_ssl => true, verify_mode => OpenSSL::SSL::VERIFY_NONE) { |http|
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('api.github.com', use_ssl => true, verify_mode => OpenSSL::SSL::VERIFY_NONE) { |http|
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('api.github.com', use_ssl => true, verify_mode => OpenSSL::SSL::VERIFY_NONE) { |http|
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('api.github.com', use_ssl => true, verify_mode => OpenSSL::SSL::VERIFY_NONE) { |http|
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
- 'https://' + @apiurl + ((path[0] == '/') ? path : ('/%s' % path))
85
+ @apiurl + ((path[0] == '/') ? path : ('/%s' % path))
86
86
  end
87
87
 
88
88
  def parameterize(params)
@@ -13,7 +13,8 @@ class Repos
13
13
  end
14
14
 
15
15
  def listRepos(user=nil)
16
- url = user ? 'users/%s/repos' % user : 'user/repos'
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
 
@@ -11,6 +11,7 @@ class UsersEmails
11
11
 
12
12
  def addEmails(emails)
13
13
  data = emails.to_json
14
+ puts data
14
15
  @github.post('user/emails', data)
15
16
  end
16
17
 
@@ -1,6 +1,5 @@
1
1
  require 'base64'
2
2
  require 'json'
3
- require 'uri'
4
3
  require 'net/http'
5
4
  require 'pathname'
6
5
  require 'rest_client'
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.8
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: 2013-04-24 00:00:00.000000000 Z
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.5.4
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.5.4
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
- - test/test.rb
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.0.3
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.
@@ -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"