octokit 0.6.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -2
- data/.travis.yml +0 -1
- data/CHANGELOG.md +1 -0
- data/Gemfile +1 -1
- data/README.md +41 -28
- data/Rakefile +11 -0
- data/lib/faraday/response/raise_octokit_error.rb +4 -2
- data/lib/octokit/client.rb +2 -0
- data/lib/octokit/client/commits.rb +12 -0
- data/lib/octokit/client/events.rb +26 -0
- data/lib/octokit/client/issues.rb +35 -7
- data/lib/octokit/client/labels.rb +5 -5
- data/lib/octokit/client/objects.rb +10 -6
- data/lib/octokit/client/organizations.rb +25 -21
- data/lib/octokit/client/pub_sub_hubbub/service_hooks.rb +2 -2
- data/lib/octokit/client/pulls.rb +4 -4
- data/lib/octokit/client/repositories.rb +18 -18
- data/lib/octokit/client/users.rb +19 -14
- data/lib/octokit/configuration.rb +14 -11
- data/lib/octokit/connection.rb +3 -3
- data/lib/octokit/request.rb +17 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +13 -12
- data/spec/fixtures/v3/blob.json +7 -0
- data/spec/fixtures/v3/commit_comment.json +19 -0
- data/spec/fixtures/v3/commit_comments.json +78 -0
- data/spec/fixtures/v3/emails.json +4 -0
- data/spec/fixtures/v3/followers.json +212 -0
- data/spec/fixtures/v3/following.json +209 -0
- data/spec/fixtures/v3/issue.json +37 -0
- data/spec/fixtures/v3/issue_closed.json +37 -0
- data/spec/fixtures/v3/issue_event.json +44 -0
- data/spec/fixtures/v3/issue_events.json +72 -0
- data/spec/fixtures/v3/list_commit_comments.json +572 -0
- data/spec/fixtures/v3/organization-repositories.json +4292 -0
- data/spec/fixtures/v3/organization-repository.json +42 -0
- data/spec/fixtures/v3/organization.json +18 -0
- data/spec/fixtures/v3/organization_members.json +576 -0
- data/spec/fixtures/v3/organization_team_members.json +16 -0
- data/spec/fixtures/v3/organization_team_repos.json +62 -0
- data/spec/fixtures/v3/organizations.json +44 -0
- data/spec/fixtures/v3/public_events.json +1110 -0
- data/spec/fixtures/v3/pull_created.json +138 -0
- data/spec/fixtures/v3/pull_request.json +138 -0
- data/spec/fixtures/v3/pull_requests.json +187 -0
- data/spec/fixtures/v3/repo_events.json +1668 -0
- data/spec/fixtures/v3/repo_issues_events.json +134 -0
- data/spec/fixtures/v3/team.json +8 -0
- data/spec/fixtures/v3/teams.json +4 -4
- data/spec/fixtures/v3/tree.json +112 -0
- data/spec/fixtures/v3/watched.json +1022 -0
- data/spec/helper.rb +3 -3
- data/spec/octokit/client/commits_spec.rb +33 -0
- data/spec/octokit/client/events_spec.rb +27 -0
- data/spec/octokit/client/issue_events_spec.rb +30 -0
- data/spec/octokit/client/issues_spec.rb +31 -20
- data/spec/octokit/client/labels_spec.rb +1 -1
- data/spec/octokit/client/objects_spec.rb +9 -8
- data/spec/octokit/client/organizations_spec.rb +56 -67
- data/spec/octokit/client/pulls_spec.rb +19 -18
- data/spec/octokit/client/repositories_spec.rb +24 -38
- data/spec/octokit/client/users_spec.rb +50 -51
- data/spec/octokit/client_spec.rb +16 -0
- metadata +111 -81
- data/puppeteer.jpg +0 -0
- data/spec/fixtures/v2/blob.json +0 -1
- data/spec/fixtures/v2/comment.json +0 -1
- data/spec/fixtures/v2/comments.json +0 -1
- data/spec/fixtures/v2/delete_failure.json +0 -1
- data/spec/fixtures/v2/delete_token.json +0 -1
- data/spec/fixtures/v2/emails.json +0 -1
- data/spec/fixtures/v2/followers.json +0 -1
- data/spec/fixtures/v2/following.json +0 -1
- data/spec/fixtures/v2/issue.json +0 -1
- data/spec/fixtures/v2/labels.json +0 -1
- data/spec/fixtures/v2/organization.json +0 -1
- data/spec/fixtures/v2/organizations.json +0 -1
- data/spec/fixtures/v2/public_keys.json +0 -1
- data/spec/fixtures/v2/pull.json +0 -1
- data/spec/fixtures/v2/pulls.json +0 -1
- data/spec/fixtures/v2/tags.json +0 -1
- data/spec/fixtures/v2/team.json +0 -1
- data/spec/fixtures/v2/teams.json +0 -1
- data/spec/fixtures/v2/tree.json +0 -1
@@ -4,17 +4,18 @@ require 'helper'
|
|
4
4
|
describe Octokit::Client::Pulls do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@client = Octokit::Client.new(:login => '
|
7
|
+
@client = Octokit::Client.new(:login => 'pengwynn')
|
8
8
|
end
|
9
9
|
|
10
10
|
describe ".create_pull_request" do
|
11
11
|
|
12
12
|
it "should create a pull request" do
|
13
|
-
stub_post("https://github.com/
|
13
|
+
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls").
|
14
14
|
with(:pull => {:base => "master", :head => "pengwynn:master", :title => "Title", :body => "Body"}).
|
15
|
-
to_return(:body => fixture("
|
16
|
-
|
17
|
-
|
15
|
+
to_return(:body => fixture("v3/pull_created.json"))
|
16
|
+
pull = @client.create_pull_request("pengwynn/octokit", "master", "pengwynn:master", "Title", "Body")
|
17
|
+
pull.number.should == 15
|
18
|
+
pull.title.should == "Pull this awesome v3 stuff"
|
18
19
|
end
|
19
20
|
|
20
21
|
end
|
@@ -22,11 +23,11 @@ describe Octokit::Client::Pulls do
|
|
22
23
|
describe ".create_pull_request_for_issue" do
|
23
24
|
|
24
25
|
it "should create a pull request and attach it to an existing issue" do
|
25
|
-
stub_post("https://github.com/
|
26
|
-
with(:pull => {:base => "master", :head => "pengwynn:
|
27
|
-
to_return(:body => fixture("
|
28
|
-
|
29
|
-
|
26
|
+
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls").
|
27
|
+
with(:pull => {:base => "master", :head => "pengwynn:octokit", :issue => "15"}).
|
28
|
+
to_return(:body => fixture("v3/pull_created.json"))
|
29
|
+
pull = @client.create_pull_request_for_issue("pengwynn/octokit", "master", "pengwynn:octokit", "15")
|
30
|
+
pull.number.should == 15
|
30
31
|
end
|
31
32
|
|
32
33
|
end
|
@@ -34,10 +35,10 @@ describe Octokit::Client::Pulls do
|
|
34
35
|
describe ".pull_requests" do
|
35
36
|
|
36
37
|
it "should return all pull requests" do
|
37
|
-
stub_get("https://github.com/
|
38
|
-
to_return(:body => fixture("
|
39
|
-
pulls = @client.pulls("
|
40
|
-
pulls.first.number.should ==
|
38
|
+
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls?state=open").
|
39
|
+
to_return(:body => fixture("v3/pull_requests.json"))
|
40
|
+
pulls = @client.pulls("pengwynn/octokit")
|
41
|
+
pulls.first.number.should == 928
|
41
42
|
end
|
42
43
|
|
43
44
|
end
|
@@ -45,10 +46,10 @@ describe Octokit::Client::Pulls do
|
|
45
46
|
describe ".pull_request" do
|
46
47
|
|
47
48
|
it "should return a pull request" do
|
48
|
-
stub_get("https://github.com/
|
49
|
-
to_return(:body => fixture("
|
50
|
-
pull = @client.pull("
|
51
|
-
pull.number.should ==
|
49
|
+
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67").
|
50
|
+
to_return(:body => fixture("v3/pull_request.json"))
|
51
|
+
pull = @client.pull("pengwynn/octokit", 67)
|
52
|
+
pull.number.should == 67
|
52
53
|
end
|
53
54
|
|
54
55
|
end
|
@@ -73,7 +73,7 @@ describe Octokit::Client::Repositories do
|
|
73
73
|
it "should watch a repository" do
|
74
74
|
stub_put("/user/watched/sferik/rails_admin").
|
75
75
|
to_return(:status => 204)
|
76
|
-
@client.watch("sferik/rails_admin").should
|
76
|
+
@client.watch("sferik/rails_admin").should be_nil
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
@@ -83,7 +83,7 @@ describe Octokit::Client::Repositories do
|
|
83
83
|
it "should unwatch a repository" do
|
84
84
|
stub_delete("/user/watched/sferik/rails_admin").
|
85
85
|
to_return(:status => 204)
|
86
|
-
@client.unwatch("sferik/rails_admin").should
|
86
|
+
@client.unwatch("sferik/rails_admin").should be_nil
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|
@@ -109,39 +109,13 @@ describe Octokit::Client::Repositories do
|
|
109
109
|
repository.name.should == "rails_admin"
|
110
110
|
end
|
111
111
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
delete_token = @client.delete_repository("sferik/rails_admin")
|
120
|
-
delete_token.should == "uhihwkkkzu"
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
describe ".delete_repository!" do
|
126
|
-
|
127
|
-
it "should delete a repository" do
|
128
|
-
stub_post("https://github.com/api/v2/json/repos/delete/sferik/rails_admin").
|
129
|
-
to_return(:body => fixture("v2/delete_token.json"))
|
130
|
-
stub_post("https://github.com/api/v2/json/repos/delete/sferik/rails_admin").
|
131
|
-
with(:delete_token => "uhihwkkkzu").
|
132
|
-
to_return(:status => 204)
|
133
|
-
@client.delete_repo!("sferik/rails_admin")
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
describe ".delete_repository" do
|
139
|
-
|
140
|
-
it "should return an error for non-existant repo" do
|
141
|
-
stub_post("https://github.com/api/v2/json/repos/delete/sferik/rails_admin_failure").
|
142
|
-
to_return(:body => fixture("v2/delete_failure.json"))
|
143
|
-
response = @client.delete_repository("sferik/rails_admin_failure")
|
144
|
-
response.error.should == "sferik/rails_admin_failure Repository not found"
|
112
|
+
it "should create a repository for an organization" do
|
113
|
+
stub_post("/orgs/comorichwebgroup/repos").
|
114
|
+
with(:name => "demo").
|
115
|
+
to_return(:body => fixture("v3/organization-repository.json"))
|
116
|
+
repository = @client.create_repository("demo", {:organization => 'comorichwebgroup'})
|
117
|
+
repository.name.should == "demo"
|
118
|
+
repository.organization.login.should == "CoMoRichWebGroup"
|
145
119
|
end
|
146
120
|
|
147
121
|
end
|
@@ -199,7 +173,7 @@ describe Octokit::Client::Repositories do
|
|
199
173
|
stub_delete("/repos/sferik/rails_admin/keys/#{103205}").
|
200
174
|
to_return(:status => 204)
|
201
175
|
result = @client.remove_deploy_key("sferik/rails_admin", 103205)
|
202
|
-
result.should
|
176
|
+
result.should be_nil
|
203
177
|
end
|
204
178
|
|
205
179
|
end
|
@@ -221,7 +195,7 @@ describe Octokit::Client::Repositories do
|
|
221
195
|
stub_put("/repos/sferik/rails_admin/collaborators/sferik").
|
222
196
|
to_return(:status => 204)
|
223
197
|
result = @client.add_collaborator("sferik/rails_admin", "sferik")
|
224
|
-
result.should
|
198
|
+
result.should be_nil
|
225
199
|
end
|
226
200
|
|
227
201
|
end
|
@@ -232,7 +206,7 @@ describe Octokit::Client::Repositories do
|
|
232
206
|
stub_delete("/repos/sferik/rails_admin/collaborators/sferik").
|
233
207
|
to_return(:status => 204)
|
234
208
|
result = @client.remove_collaborator("sferik/rails_admin", "sferik")
|
235
|
-
result.should
|
209
|
+
result.should be_nil
|
236
210
|
end
|
237
211
|
|
238
212
|
end
|
@@ -342,4 +316,16 @@ describe Octokit::Client::Repositories do
|
|
342
316
|
|
343
317
|
end
|
344
318
|
|
319
|
+
describe ".events" do
|
320
|
+
|
321
|
+
it "should list event for all issues in a repository" do
|
322
|
+
stub_get("/repos/pengwynn/octokit/issues/events").
|
323
|
+
to_return(:body => fixture("v3/repo_issues_events.json"))
|
324
|
+
events = @client.repo_issue_events("pengwynn/octokit")
|
325
|
+
events.first.actor.login.should == "ctshryock"
|
326
|
+
events.first.event.should == "subscribed"
|
327
|
+
end
|
328
|
+
|
329
|
+
end
|
330
|
+
|
345
331
|
end
|
@@ -80,10 +80,10 @@ describe Octokit::Client::Users do
|
|
80
80
|
context "with a username passed" do
|
81
81
|
|
82
82
|
it "should return the user's followers" do
|
83
|
-
stub_get("https://github.com/
|
84
|
-
to_return(:body => fixture("
|
83
|
+
stub_get("https://api.github.com/users/sferik/followers").
|
84
|
+
to_return(:body => fixture("v3/followers.json"))
|
85
85
|
users = @client.followers("sferik")
|
86
|
-
users.first.should == "puls"
|
86
|
+
users.first.login.should == "puls"
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|
@@ -91,10 +91,10 @@ describe Octokit::Client::Users do
|
|
91
91
|
context "without a username passed" do
|
92
92
|
|
93
93
|
it "should return the user's followers" do
|
94
|
-
stub_get("https://github.com/
|
95
|
-
to_return(:body => fixture("
|
94
|
+
stub_get("https://api.github.com/users/sferik/followers").
|
95
|
+
to_return(:body => fixture("v3/followers.json"))
|
96
96
|
users = @client.followers
|
97
|
-
users.first.should == "puls"
|
97
|
+
users.first.login.should == "puls"
|
98
98
|
end
|
99
99
|
|
100
100
|
end
|
@@ -106,10 +106,10 @@ describe Octokit::Client::Users do
|
|
106
106
|
context "with a username passed" do
|
107
107
|
|
108
108
|
it "should return the user's following" do
|
109
|
-
stub_get("https://github.com/
|
110
|
-
to_return(:body => fixture("
|
109
|
+
stub_get("https://api.github.com/users/sferik/following").
|
110
|
+
to_return(:body => fixture("v3/following.json"))
|
111
111
|
users = @client.following("sferik")
|
112
|
-
users.first.should == "rails"
|
112
|
+
users.first.login.should == "rails"
|
113
113
|
end
|
114
114
|
|
115
115
|
end
|
@@ -117,10 +117,10 @@ describe Octokit::Client::Users do
|
|
117
117
|
context "without a username passed" do
|
118
118
|
|
119
119
|
it "should return the user's following" do
|
120
|
-
stub_get("https://github.com/
|
121
|
-
to_return(:body => fixture("
|
120
|
+
stub_get("https://api.github.com/users/sferik/following").
|
121
|
+
to_return(:body => fixture("v3/following.json"))
|
122
122
|
users = @client.following
|
123
|
-
users.first.should == "rails"
|
123
|
+
users.first.login.should == "rails"
|
124
124
|
end
|
125
125
|
|
126
126
|
end
|
@@ -132,9 +132,9 @@ describe Octokit::Client::Users do
|
|
132
132
|
context "with one user following another" do
|
133
133
|
|
134
134
|
it "should return true" do
|
135
|
-
stub_get("https://github.com/
|
136
|
-
to_return(:body =>
|
137
|
-
follows = @client.follows?("sferik", "
|
135
|
+
stub_get("https://api.github.com/user/following/puls").
|
136
|
+
to_return(:status => 204, :body => "")
|
137
|
+
follows = @client.follows?("sferik", "puls")
|
138
138
|
follows.should be_true
|
139
139
|
end
|
140
140
|
|
@@ -143,8 +143,8 @@ describe Octokit::Client::Users do
|
|
143
143
|
context "with one user not following another" do
|
144
144
|
|
145
145
|
it "should return false" do
|
146
|
-
stub_get("https://github.com/
|
147
|
-
to_return(:body =>
|
146
|
+
stub_get("https://api.github.com/user/following/dogbrainz").
|
147
|
+
to_return(:status => 404, :body => "")
|
148
148
|
follows = @client.follows?("sferik", "dogbrainz")
|
149
149
|
follows.should be_false
|
150
150
|
end
|
@@ -156,10 +156,10 @@ describe Octokit::Client::Users do
|
|
156
156
|
describe ".follow" do
|
157
157
|
|
158
158
|
it "should follow a user" do
|
159
|
-
|
160
|
-
to_return(:body =>
|
159
|
+
stub_put("https://api.github.com/user/following/dianakimball").
|
160
|
+
to_return(:status => 204, :body => "")
|
161
161
|
following = @client.follow("dianakimball")
|
162
|
-
following.should
|
162
|
+
following.should be_true
|
163
163
|
end
|
164
164
|
|
165
165
|
end
|
@@ -167,10 +167,10 @@ describe Octokit::Client::Users do
|
|
167
167
|
describe ".unfollow" do
|
168
168
|
|
169
169
|
it "should unfollow a user" do
|
170
|
-
|
171
|
-
to_return(:body =>
|
170
|
+
stub_delete("https://api.github.com/user/following/dogbrainz").
|
171
|
+
to_return(:status => 204, :body => "")
|
172
172
|
following = @client.unfollow("dogbrainz")
|
173
|
-
following.
|
173
|
+
following.should be_true
|
174
174
|
end
|
175
175
|
|
176
176
|
end
|
@@ -180,10 +180,10 @@ describe Octokit::Client::Users do
|
|
180
180
|
context "with a username passed" do
|
181
181
|
|
182
182
|
it "should return watched repositories" do
|
183
|
-
stub_get("https://github.com/
|
184
|
-
to_return(:body => fixture("
|
183
|
+
stub_get("https://api.github.com/users/sferik/watched").
|
184
|
+
to_return(:body => fixture("v3/watched.json"))
|
185
185
|
repositories = @client.watched("sferik")
|
186
|
-
repositories.first.name.should == "
|
186
|
+
repositories.first.name.should == "grit"
|
187
187
|
end
|
188
188
|
|
189
189
|
end
|
@@ -191,10 +191,10 @@ describe Octokit::Client::Users do
|
|
191
191
|
context "without a username passed" do
|
192
192
|
|
193
193
|
it "should return watched repositories" do
|
194
|
-
stub_get("https://github.com/
|
195
|
-
to_return(:body => fixture("
|
194
|
+
stub_get("https://api.github.com/users/sferik/watched").
|
195
|
+
to_return(:body => fixture("v3/watched.json"))
|
196
196
|
repositories = @client.watched
|
197
|
-
repositories.first.name.should == "
|
197
|
+
repositories.first.name.should == "grit"
|
198
198
|
end
|
199
199
|
|
200
200
|
end
|
@@ -204,8 +204,8 @@ describe Octokit::Client::Users do
|
|
204
204
|
describe ".keys" do
|
205
205
|
|
206
206
|
it "should return public keys" do
|
207
|
-
stub_get("https://github.com/
|
208
|
-
to_return(:body => fixture("
|
207
|
+
stub_get("https://api.github.com/user/keys").
|
208
|
+
to_return(:body => fixture("v3/public_keys.json"))
|
209
209
|
public_keys = @client.keys
|
210
210
|
public_keys.first.id.should == 103205
|
211
211
|
end
|
@@ -215,11 +215,12 @@ describe Octokit::Client::Users do
|
|
215
215
|
describe ".add_key" do
|
216
216
|
|
217
217
|
it "should add a public key" do
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
218
|
+
title, key = "Moss", "ssh-dss AAAAB3NzaC1kc3MAAACBAJz7HanBa18ad1YsdFzHO5Wy1/WgXd4BV+czbKq7q23jungbfjN3eo2a0SVdxux8GG+RZ9ia90VD/X+PE4s3LV60oXZ7PDAuyPO1CTF0TaDoKf9mPaHcPa6agMJVocMsgBgwviWT1Q9VgN1SccDsYVDtxkIAwuw25YeHZlG6myx1AAAAFQCgW+OvXWUdUJPBGkRJ8ML7uf0VHQAAAIAlP5G96tTss0SKYVSCJCyocn9cyGQdNjxah4/aYuYFTbLI1rxk7sr/AkZfJNIoF2UFyO5STbbratykIQGUPdUBg1a2t72bu31x+4ZYJMngNsG/AkZ2oqLiH6dJKHD7PFx2oSPalogwsUV7iSMIZIYaPa03A9763iFsN0qJjaed+gAAAIBxz3Prxdzt/os4XGXSMNoWcS03AFC/05NOkoDMrXxQnTTpp1wrOgyRqEnKz15qC5dWk1ynzK+LJXHDZGA8lXPfCjHpJO3zrlZ/ivvLhgPdDpt13MAhIJFH06hTal0woxbk/fIdY71P3kbgXC0Ppx/0S7BC+VxqRCA4/wcM+BoDbA== host"
|
219
|
+
stub_post("https://api.github.com/user/keys").
|
220
|
+
with(:title => title, :key => key).
|
221
|
+
to_return(:status => 201, :body => fixture("v3/public_key.json"))
|
222
|
+
public_key = @client.add_key(title, key)
|
223
|
+
public_key.id.should == 103205
|
223
224
|
end
|
224
225
|
|
225
226
|
end
|
@@ -227,11 +228,10 @@ describe Octokit::Client::Users do
|
|
227
228
|
describe ".remove_key" do
|
228
229
|
|
229
230
|
it "should remove a public key" do
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
public_keys.first.id.should == 103205
|
231
|
+
stub_delete("https://api.github.com/user/keys/103205").
|
232
|
+
to_return(:status => 204, :body => "")
|
233
|
+
response = @client.remove_key(103205)
|
234
|
+
response.should be_true
|
235
235
|
end
|
236
236
|
|
237
237
|
end
|
@@ -239,8 +239,8 @@ describe Octokit::Client::Users do
|
|
239
239
|
describe ".emails" do
|
240
240
|
|
241
241
|
it "should return email addresses" do
|
242
|
-
stub_get("https://github.com/
|
243
|
-
to_return(:body => fixture("
|
242
|
+
stub_get("https://api.github.com/user/emails").
|
243
|
+
to_return(:body => fixture("v3/emails.json"))
|
244
244
|
emails = @client.emails
|
245
245
|
emails.first.should == "sferik@gmail.com"
|
246
246
|
end
|
@@ -250,23 +250,22 @@ describe Octokit::Client::Users do
|
|
250
250
|
describe ".add_email" do
|
251
251
|
|
252
252
|
it "should add an email address" do
|
253
|
-
stub_post("https://github.com/
|
253
|
+
stub_post("https://api.github.com/user/emails").
|
254
254
|
with(:email => "sferik@gmail.com").
|
255
|
-
to_return(:body => fixture("
|
255
|
+
to_return(:body => fixture("v3/emails.json"))
|
256
256
|
emails = @client.add_email("sferik@gmail.com")
|
257
257
|
emails.first.should == "sferik@gmail.com"
|
258
258
|
end
|
259
259
|
|
260
260
|
end
|
261
261
|
|
262
|
-
describe ".
|
262
|
+
describe ".remove_email" do
|
263
263
|
|
264
264
|
it "should remove an email address" do
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
emails.first.should == "sferik@gmail.com"
|
265
|
+
stub_delete("https://api.github.com/user/emails?email=sferik@gmail.com").
|
266
|
+
to_return(:status => 204, :body => "")
|
267
|
+
response = @client.remove_email("sferik@gmail.com")
|
268
|
+
response.should be_true
|
270
269
|
end
|
271
270
|
|
272
271
|
end
|
data/spec/octokit/client_spec.rb
CHANGED
@@ -9,4 +9,20 @@ describe Octokit::Client do
|
|
9
9
|
Octokit::Client.new(:login => 'foo', :password => 'bar').commits('baz/quux')
|
10
10
|
}.should_not raise_exception
|
11
11
|
end
|
12
|
+
|
13
|
+
it "should traverse a paginated response if auto_traversal is on" do
|
14
|
+
stub_get("https://api.github.com/foo/bar").
|
15
|
+
to_return(:status => 200, :body => %q{["stuff"]}, :headers =>
|
16
|
+
{ 'Link' => %q{<https://api.github.com/foo/bar?page=2>; rel="next", <https://api.github.com/foo/bar?page=3>; rel="last"} })
|
17
|
+
|
18
|
+
stub_get("https://api.github.com/foo/bar?page=2").
|
19
|
+
to_return(:status => 200, :body => %q{["even more stuff"]}, :headers =>
|
20
|
+
{ 'Link' => %q{<https://api.github.com/foo/bar?page=3>; rel="next", <https://api.github.com/foo/bar?page=3>; rel="last", <https://api.github.com/foo/bar?page=1>; rel="prev", <https://api.github.com/foo/bar?page=1>; rel="first"} })
|
21
|
+
|
22
|
+
stub_get("https://api.github.com/foo/bar?page=3").
|
23
|
+
to_return(:status => 200, :body => %q{["stuffapalooza"]}, :headers =>
|
24
|
+
{ 'Link' => %q{<https://api.github.com/foo/bar?page=2>; rel="prev", <https://api.github.com/foo/bar?page=1>; rel="first"} })
|
25
|
+
|
26
|
+
Octokit::Client.new(:auto_traversal => true).get("https://api.github.com/foo/bar", {}, 3).should == ['stuff', 'even more stuff', 'stuffapalooza']
|
27
|
+
end
|
12
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,130 +11,141 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2012-02-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: addressable
|
18
|
-
requirement: &
|
18
|
+
requirement: &70290067718980 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.2
|
23
|
+
version: '2.2'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70290067718980
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
|
-
requirement: &
|
29
|
+
requirement: &70290067721200 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.7
|
34
|
+
version: '0.7'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70290067721200
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: faraday_middleware
|
40
|
-
requirement: &
|
40
|
+
requirement: &70290067730980 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
45
|
+
version: '0.8'
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70290067730980
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: hashie
|
51
|
-
requirement: &
|
51
|
+
requirement: &70290067778320 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 1.2
|
56
|
+
version: '1.2'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70290067778320
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: multi_json
|
62
|
-
requirement: &
|
62
|
+
requirement: &70290067795800 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 1.0
|
67
|
+
version: '1.0'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70290067795800
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: json
|
73
|
-
requirement: &
|
73
|
+
requirement: &70290067805640 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ! '>='
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: '
|
78
|
+
version: '0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70290067805640
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: rake
|
84
|
-
requirement: &
|
84
|
+
requirement: &70290067814300 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70290067814300
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: rspec
|
95
|
-
requirement: &
|
95
|
+
requirement: &70290067823200 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ~>
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: '2.
|
100
|
+
version: '2.8'
|
101
101
|
type: :development
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70290067823200
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: simplecov
|
106
|
-
requirement: &
|
106
|
+
requirement: &70290067833280 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ! '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0
|
111
|
+
version: '0'
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *70290067833280
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: webmock
|
117
|
-
requirement: &
|
117
|
+
requirement: &70290067832080 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ! '>='
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
122
|
+
version: '0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
|
-
version_requirements: *
|
125
|
+
version_requirements: *70290067832080
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: yard
|
128
|
-
requirement: &
|
128
|
+
requirement: &70290067831340 !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
|
-
- -
|
131
|
+
- - ! '>='
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: '0
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: *70290067831340
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: rdiscount
|
139
|
+
requirement: &70290067830080 !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
134
145
|
type: :development
|
135
146
|
prerelease: false
|
136
|
-
version_requirements: *
|
137
|
-
description: Simple wrapper for the GitHub API v2
|
147
|
+
version_requirements: *70290067830080
|
148
|
+
description: Simple wrapper for the GitHub API (v2 and v3)
|
138
149
|
email:
|
139
150
|
- wynn.netherland@gmail.com
|
140
151
|
- adam@stacoviak.com
|
@@ -158,6 +169,7 @@ files:
|
|
158
169
|
- lib/octokit/authentication.rb
|
159
170
|
- lib/octokit/client.rb
|
160
171
|
- lib/octokit/client/commits.rb
|
172
|
+
- lib/octokit/client/events.rb
|
161
173
|
- lib/octokit/client/issues.rb
|
162
174
|
- lib/octokit/client/labels.rb
|
163
175
|
- lib/octokit/client/milestones.rb
|
@@ -177,63 +189,72 @@ files:
|
|
177
189
|
- lib/octokit/request.rb
|
178
190
|
- lib/octokit/version.rb
|
179
191
|
- octokit.gemspec
|
180
|
-
- puppeteer.jpg
|
181
192
|
- spec/faraday/response_spec.rb
|
182
193
|
- spec/fixtures/timeline.json
|
183
|
-
- spec/fixtures/v2/blob.json
|
184
194
|
- spec/fixtures/v2/blob_metadata.json
|
185
195
|
- spec/fixtures/v2/blobs.json
|
186
|
-
- spec/fixtures/v2/comment.json
|
187
|
-
- spec/fixtures/v2/comments.json
|
188
|
-
- spec/fixtures/v2/delete_failure.json
|
189
|
-
- spec/fixtures/v2/delete_token.json
|
190
|
-
- spec/fixtures/v2/emails.json
|
191
|
-
- spec/fixtures/v2/followers.json
|
192
|
-
- spec/fixtures/v2/following.json
|
193
|
-
- spec/fixtures/v2/issue.json
|
194
196
|
- spec/fixtures/v2/issues.json
|
195
|
-
- spec/fixtures/v2/labels.json
|
196
197
|
- spec/fixtures/v2/network_data.json
|
197
198
|
- spec/fixtures/v2/network_meta.json
|
198
|
-
- spec/fixtures/v2/organization.json
|
199
|
-
- spec/fixtures/v2/organizations.json
|
200
|
-
- spec/fixtures/v2/public_keys.json
|
201
|
-
- spec/fixtures/v2/pull.json
|
202
|
-
- spec/fixtures/v2/pulls.json
|
203
199
|
- spec/fixtures/v2/raw.txt
|
204
200
|
- spec/fixtures/v2/repositories.json
|
205
|
-
- spec/fixtures/v2/tags.json
|
206
|
-
- spec/fixtures/v2/team.json
|
207
|
-
- spec/fixtures/v2/teams.json
|
208
|
-
- spec/fixtures/v2/tree.json
|
209
201
|
- spec/fixtures/v2/tree_metadata.json
|
210
202
|
- spec/fixtures/v2/user.json
|
211
203
|
- spec/fixtures/v2/users.json
|
204
|
+
- spec/fixtures/v3/blob.json
|
212
205
|
- spec/fixtures/v3/branches.json
|
213
206
|
- spec/fixtures/v3/collaborators.json
|
214
207
|
- spec/fixtures/v3/comment.json
|
215
208
|
- spec/fixtures/v3/comments.json
|
216
209
|
- spec/fixtures/v3/commit.json
|
210
|
+
- spec/fixtures/v3/commit_comment.json
|
211
|
+
- spec/fixtures/v3/commit_comments.json
|
217
212
|
- spec/fixtures/v3/commits.json
|
218
213
|
- spec/fixtures/v3/contributors.json
|
214
|
+
- spec/fixtures/v3/emails.json
|
215
|
+
- spec/fixtures/v3/followers.json
|
216
|
+
- spec/fixtures/v3/following.json
|
219
217
|
- spec/fixtures/v3/forks.json
|
218
|
+
- spec/fixtures/v3/issue.json
|
219
|
+
- spec/fixtures/v3/issue_closed.json
|
220
|
+
- spec/fixtures/v3/issue_event.json
|
221
|
+
- spec/fixtures/v3/issue_events.json
|
220
222
|
- spec/fixtures/v3/issues.json
|
221
223
|
- spec/fixtures/v3/label.json
|
222
224
|
- spec/fixtures/v3/labels.json
|
223
225
|
- spec/fixtures/v3/languages.json
|
226
|
+
- spec/fixtures/v3/list_commit_comments.json
|
224
227
|
- spec/fixtures/v3/milestone.json
|
225
228
|
- spec/fixtures/v3/milestones.json
|
226
229
|
- spec/fixtures/v3/not_found.json
|
230
|
+
- spec/fixtures/v3/organization-repositories.json
|
231
|
+
- spec/fixtures/v3/organization-repository.json
|
232
|
+
- spec/fixtures/v3/organization.json
|
233
|
+
- spec/fixtures/v3/organization_members.json
|
234
|
+
- spec/fixtures/v3/organization_team_members.json
|
235
|
+
- spec/fixtures/v3/organization_team_repos.json
|
236
|
+
- spec/fixtures/v3/organizations.json
|
237
|
+
- spec/fixtures/v3/public_events.json
|
227
238
|
- spec/fixtures/v3/public_key.json
|
228
239
|
- spec/fixtures/v3/public_keys.json
|
240
|
+
- spec/fixtures/v3/pull_created.json
|
241
|
+
- spec/fixtures/v3/pull_request.json
|
242
|
+
- spec/fixtures/v3/pull_requests.json
|
243
|
+
- spec/fixtures/v3/repo_events.json
|
244
|
+
- spec/fixtures/v3/repo_issues_events.json
|
229
245
|
- spec/fixtures/v3/repositories.json
|
230
246
|
- spec/fixtures/v3/repository.json
|
231
247
|
- spec/fixtures/v3/tags.json
|
248
|
+
- spec/fixtures/v3/team.json
|
232
249
|
- spec/fixtures/v3/teams.json
|
250
|
+
- spec/fixtures/v3/tree.json
|
233
251
|
- spec/fixtures/v3/user.json
|
252
|
+
- spec/fixtures/v3/watched.json
|
234
253
|
- spec/fixtures/v3/watchers.json
|
235
254
|
- spec/helper.rb
|
236
255
|
- spec/octokit/client/commits_spec.rb
|
256
|
+
- spec/octokit/client/events_spec.rb
|
257
|
+
- spec/octokit/client/issue_events_spec.rb
|
237
258
|
- spec/octokit/client/issues_spec.rb
|
238
259
|
- spec/octokit/client/labels_spec.rb
|
239
260
|
- spec/octokit/client/milestones_spec.rb
|
@@ -276,60 +297,70 @@ summary: Wrapper for the GitHub API
|
|
276
297
|
test_files:
|
277
298
|
- spec/faraday/response_spec.rb
|
278
299
|
- spec/fixtures/timeline.json
|
279
|
-
- spec/fixtures/v2/blob.json
|
280
300
|
- spec/fixtures/v2/blob_metadata.json
|
281
301
|
- spec/fixtures/v2/blobs.json
|
282
|
-
- spec/fixtures/v2/comment.json
|
283
|
-
- spec/fixtures/v2/comments.json
|
284
|
-
- spec/fixtures/v2/delete_failure.json
|
285
|
-
- spec/fixtures/v2/delete_token.json
|
286
|
-
- spec/fixtures/v2/emails.json
|
287
|
-
- spec/fixtures/v2/followers.json
|
288
|
-
- spec/fixtures/v2/following.json
|
289
|
-
- spec/fixtures/v2/issue.json
|
290
302
|
- spec/fixtures/v2/issues.json
|
291
|
-
- spec/fixtures/v2/labels.json
|
292
303
|
- spec/fixtures/v2/network_data.json
|
293
304
|
- spec/fixtures/v2/network_meta.json
|
294
|
-
- spec/fixtures/v2/organization.json
|
295
|
-
- spec/fixtures/v2/organizations.json
|
296
|
-
- spec/fixtures/v2/public_keys.json
|
297
|
-
- spec/fixtures/v2/pull.json
|
298
|
-
- spec/fixtures/v2/pulls.json
|
299
305
|
- spec/fixtures/v2/raw.txt
|
300
306
|
- spec/fixtures/v2/repositories.json
|
301
|
-
- spec/fixtures/v2/tags.json
|
302
|
-
- spec/fixtures/v2/team.json
|
303
|
-
- spec/fixtures/v2/teams.json
|
304
|
-
- spec/fixtures/v2/tree.json
|
305
307
|
- spec/fixtures/v2/tree_metadata.json
|
306
308
|
- spec/fixtures/v2/user.json
|
307
309
|
- spec/fixtures/v2/users.json
|
310
|
+
- spec/fixtures/v3/blob.json
|
308
311
|
- spec/fixtures/v3/branches.json
|
309
312
|
- spec/fixtures/v3/collaborators.json
|
310
313
|
- spec/fixtures/v3/comment.json
|
311
314
|
- spec/fixtures/v3/comments.json
|
312
315
|
- spec/fixtures/v3/commit.json
|
316
|
+
- spec/fixtures/v3/commit_comment.json
|
317
|
+
- spec/fixtures/v3/commit_comments.json
|
313
318
|
- spec/fixtures/v3/commits.json
|
314
319
|
- spec/fixtures/v3/contributors.json
|
320
|
+
- spec/fixtures/v3/emails.json
|
321
|
+
- spec/fixtures/v3/followers.json
|
322
|
+
- spec/fixtures/v3/following.json
|
315
323
|
- spec/fixtures/v3/forks.json
|
324
|
+
- spec/fixtures/v3/issue.json
|
325
|
+
- spec/fixtures/v3/issue_closed.json
|
326
|
+
- spec/fixtures/v3/issue_event.json
|
327
|
+
- spec/fixtures/v3/issue_events.json
|
316
328
|
- spec/fixtures/v3/issues.json
|
317
329
|
- spec/fixtures/v3/label.json
|
318
330
|
- spec/fixtures/v3/labels.json
|
319
331
|
- spec/fixtures/v3/languages.json
|
332
|
+
- spec/fixtures/v3/list_commit_comments.json
|
320
333
|
- spec/fixtures/v3/milestone.json
|
321
334
|
- spec/fixtures/v3/milestones.json
|
322
335
|
- spec/fixtures/v3/not_found.json
|
336
|
+
- spec/fixtures/v3/organization-repositories.json
|
337
|
+
- spec/fixtures/v3/organization-repository.json
|
338
|
+
- spec/fixtures/v3/organization.json
|
339
|
+
- spec/fixtures/v3/organization_members.json
|
340
|
+
- spec/fixtures/v3/organization_team_members.json
|
341
|
+
- spec/fixtures/v3/organization_team_repos.json
|
342
|
+
- spec/fixtures/v3/organizations.json
|
343
|
+
- spec/fixtures/v3/public_events.json
|
323
344
|
- spec/fixtures/v3/public_key.json
|
324
345
|
- spec/fixtures/v3/public_keys.json
|
346
|
+
- spec/fixtures/v3/pull_created.json
|
347
|
+
- spec/fixtures/v3/pull_request.json
|
348
|
+
- spec/fixtures/v3/pull_requests.json
|
349
|
+
- spec/fixtures/v3/repo_events.json
|
350
|
+
- spec/fixtures/v3/repo_issues_events.json
|
325
351
|
- spec/fixtures/v3/repositories.json
|
326
352
|
- spec/fixtures/v3/repository.json
|
327
353
|
- spec/fixtures/v3/tags.json
|
354
|
+
- spec/fixtures/v3/team.json
|
328
355
|
- spec/fixtures/v3/teams.json
|
356
|
+
- spec/fixtures/v3/tree.json
|
329
357
|
- spec/fixtures/v3/user.json
|
358
|
+
- spec/fixtures/v3/watched.json
|
330
359
|
- spec/fixtures/v3/watchers.json
|
331
360
|
- spec/helper.rb
|
332
361
|
- spec/octokit/client/commits_spec.rb
|
362
|
+
- spec/octokit/client/events_spec.rb
|
363
|
+
- spec/octokit/client/issue_events_spec.rb
|
333
364
|
- spec/octokit/client/issues_spec.rb
|
334
365
|
- spec/octokit/client/labels_spec.rb
|
335
366
|
- spec/octokit/client/milestones_spec.rb
|
@@ -345,4 +376,3 @@ test_files:
|
|
345
376
|
- spec/octokit/client_spec.rb
|
346
377
|
- spec/octokit_spec.rb
|
347
378
|
- spec/repository_spec.rb
|
348
|
-
has_rdoc:
|