octokit 1.19.0 → 1.20.0
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/.travis.yml +2 -0
- data/CHANGELOG.md +11 -0
- data/README.md +35 -1
- data/lib/faraday/response/raise_octokit_error.rb +15 -22
- data/lib/octokit.rb +2 -1
- data/lib/octokit/authentication.rb +15 -0
- data/lib/octokit/client.rb +4 -0
- data/lib/octokit/client/authorizations.rb +1 -1
- data/lib/octokit/client/commits.rb +15 -14
- data/lib/octokit/client/contents.rb +42 -42
- data/lib/octokit/client/downloads.rb +5 -1
- data/lib/octokit/client/gists.rb +6 -12
- data/lib/octokit/client/gitignore.rb +41 -0
- data/lib/octokit/client/issues.rb +30 -1
- data/lib/octokit/client/labels.rb +2 -2
- data/lib/octokit/client/milestones.rb +1 -1
- data/lib/octokit/client/notifications.rb +1 -5
- data/lib/octokit/client/organizations.rb +11 -15
- data/lib/octokit/client/pulls.rb +33 -7
- data/lib/octokit/client/refs.rb +1 -1
- data/lib/octokit/client/repositories.rb +27 -40
- data/lib/octokit/client/users.rb +25 -13
- data/lib/octokit/configuration.rb +4 -2
- data/lib/octokit/connection.rb +6 -4
- data/lib/octokit/request.rb +9 -0
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +2 -1
- data/spec/fixtures/.netrc +2 -0
- data/spec/fixtures/all_repositories.json +122 -0
- data/spec/fixtures/all_users.json +34 -0
- data/spec/fixtures/gitignore_template_ruby.json +4 -0
- data/spec/fixtures/gitignore_templates.json +78 -0
- data/spec/fixtures/pull_requests_comments.json +82 -0
- data/spec/fixtures/repository_issues_comments.json +52 -0
- data/spec/octokit/client/authorizations_spec.rb +1 -1
- data/spec/octokit/client/commits_spec.rb +1 -1
- data/spec/octokit/client/downloads_spec.rb +1 -1
- data/spec/octokit/client/gists_spec.rb +6 -6
- data/spec/octokit/client/gitignore_spec.rb +29 -0
- data/spec/octokit/client/issues_spec.rb +12 -1
- data/spec/octokit/client/labels_spec.rb +2 -2
- data/spec/octokit/client/milestones_spec.rb +1 -1
- data/spec/octokit/client/notifications_spec.rb +10 -10
- data/spec/octokit/client/organizations_spec.rb +10 -10
- data/spec/octokit/client/pulls_spec.rb +13 -2
- data/spec/octokit/client/refs_spec.rb +1 -1
- data/spec/octokit/client/repositories_spec.rb +25 -14
- data/spec/octokit/client/users_spec.rb +17 -6
- data/spec/octokit/client_spec.rb +47 -1
- data/spec/octokit_spec.rb +1 -1
- metadata +36 -3
@@ -22,6 +22,17 @@ describe Octokit::Client::Users do
|
|
22
22
|
|
23
23
|
end
|
24
24
|
|
25
|
+
describe ".all_users" do
|
26
|
+
|
27
|
+
it "returns all GitHub users" do
|
28
|
+
stub_get("/users").
|
29
|
+
to_return(json_response("all_users.json"))
|
30
|
+
users = @client.all_users
|
31
|
+
expect(users.first.login).to eq("mojombo")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
25
36
|
describe ".user" do
|
26
37
|
|
27
38
|
context "with a username passed" do
|
@@ -133,7 +144,7 @@ describe Octokit::Client::Users do
|
|
133
144
|
stub_get("https://api.github.com/user/following/puls").
|
134
145
|
to_return(:status => 204, :body => "")
|
135
146
|
follows = @client.follows?("sferik", "puls")
|
136
|
-
expect(follows).to
|
147
|
+
expect(follows).to eq(true)
|
137
148
|
end
|
138
149
|
|
139
150
|
end
|
@@ -157,7 +168,7 @@ describe Octokit::Client::Users do
|
|
157
168
|
stub_put("https://api.github.com/user/following/dianakimball").
|
158
169
|
to_return(:status => 204, :body => "")
|
159
170
|
following = @client.follow("dianakimball")
|
160
|
-
expect(following).to
|
171
|
+
expect(following).to eq(true)
|
161
172
|
end
|
162
173
|
|
163
174
|
end
|
@@ -168,7 +179,7 @@ describe Octokit::Client::Users do
|
|
168
179
|
stub_delete("https://api.github.com/user/following/dogbrainz").
|
169
180
|
to_return(:status => 204, :body => "")
|
170
181
|
following = @client.unfollow("dogbrainz")
|
171
|
-
expect(following).to
|
182
|
+
expect(following).to eq(true)
|
172
183
|
end
|
173
184
|
|
174
185
|
end
|
@@ -181,7 +192,7 @@ describe Octokit::Client::Users do
|
|
181
192
|
stub_get("https://api.github.com/user/starred/sferik/rails_admin").
|
182
193
|
to_return(:status => 204, :body => "")
|
183
194
|
starred = @client.starred?("sferik", "rails_admin")
|
184
|
-
expect(starred).to
|
195
|
+
expect(starred).to eq(true)
|
185
196
|
end
|
186
197
|
|
187
198
|
end
|
@@ -310,7 +321,7 @@ describe Octokit::Client::Users do
|
|
310
321
|
stub_delete("https://api.github.com/user/keys/103205").
|
311
322
|
to_return(:status => 204, :body => "")
|
312
323
|
response = @client.remove_key(103205)
|
313
|
-
expect(response).to
|
324
|
+
expect(response).to eq(true)
|
314
325
|
end
|
315
326
|
|
316
327
|
end
|
@@ -344,7 +355,7 @@ describe Octokit::Client::Users do
|
|
344
355
|
stub_delete("https://api.github.com/user/emails?email=sferik@gmail.com").
|
345
356
|
to_return(:status => 204, :body => "")
|
346
357
|
response = @client.remove_email("sferik@gmail.com")
|
347
|
-
expect(response).to
|
358
|
+
expect(response).to eq(true)
|
348
359
|
end
|
349
360
|
|
350
361
|
end
|
data/spec/octokit/client_spec.rb
CHANGED
@@ -1,6 +1,32 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe Octokit::Client do
|
4
|
+
|
5
|
+
before do
|
6
|
+
File.chmod 0600, "spec/fixtures/.netrc"
|
7
|
+
Octokit.reset
|
8
|
+
end
|
9
|
+
|
10
|
+
it "sets a default user agent" do
|
11
|
+
stub_request(:get, "https://api.github.com/rate_limit").
|
12
|
+
with(:headers => {:user_agent => Octokit.user_agent }).
|
13
|
+
to_return(:status => 200, :body => '', :headers =>
|
14
|
+
{ 'X-RateLimit-Limit' => 5000, 'X-RateLimit-Remaining' => 5000})
|
15
|
+
|
16
|
+
Octokit.rate_limit
|
17
|
+
end
|
18
|
+
|
19
|
+
it "allows a custom user agent" do
|
20
|
+
Octokit.user_agent = 'My mashup'
|
21
|
+
|
22
|
+
stub_request(:get, "https://api.github.com/rate_limit").
|
23
|
+
with(:headers => {:user_agent => 'My mashup' }).
|
24
|
+
to_return(:status => 200, :body => '', :headers =>
|
25
|
+
{ 'X-RateLimit-Limit' => 5000, 'X-RateLimit-Remaining' => 5000})
|
26
|
+
|
27
|
+
Octokit.rate_limit
|
28
|
+
end
|
29
|
+
|
4
30
|
it "works with basic auth and password" do
|
5
31
|
stub_get("https://foo:bar@api.github.com/repos/baz/quux/commits?per_page=35&sha=master").
|
6
32
|
to_return(:status => 200, :body => '{"commits":[]}', :headers => {})
|
@@ -9,6 +35,25 @@ describe Octokit::Client do
|
|
9
35
|
}.not_to raise_exception
|
10
36
|
end
|
11
37
|
|
38
|
+
it "can read .netrc files" do
|
39
|
+
stub_get("https://sferik:il0veruby@api.github.com/user").
|
40
|
+
to_return(json_response("user.json"))
|
41
|
+
Octokit.reset
|
42
|
+
client = Octokit::Client.new(:netrc => File.join(fixture_path, '.netrc'))
|
43
|
+
user = client.user
|
44
|
+
expect(user.login).to eq("sferik")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "can read non-standard API endpoint creds from .netrc" do
|
48
|
+
stub_get("http://defunkt:il0veruby@api.github.dev/user").
|
49
|
+
to_return(json_response("user.json"))
|
50
|
+
Octokit.reset
|
51
|
+
Octokit.api_endpoint = "http://api.github.dev"
|
52
|
+
client = Octokit::Client.new(:netrc => File.join(fixture_path, '.netrc'))
|
53
|
+
user = client.user
|
54
|
+
expect(user.followers).to eq(205)
|
55
|
+
end
|
56
|
+
|
12
57
|
it "configures faraday from faraday_config_block" do
|
13
58
|
mw_evaluated = false
|
14
59
|
Octokit.configure do |c|
|
@@ -19,7 +64,7 @@ describe Octokit::Client do
|
|
19
64
|
{ 'X-RateLimit-Limit' => 5000, 'X-RateLimit-Remaining' => 5000})
|
20
65
|
client = Octokit::Client.new()
|
21
66
|
client.rate_limit
|
22
|
-
expect(mw_evaluated).to
|
67
|
+
expect(mw_evaluated).to eq(true)
|
23
68
|
end
|
24
69
|
|
25
70
|
|
@@ -131,6 +176,7 @@ describe Octokit::Client do
|
|
131
176
|
client = Octokit::Client.new
|
132
177
|
expect(client.api_endpoint).to eq('http://foo.dev/')
|
133
178
|
end
|
179
|
+
|
134
180
|
end
|
135
181
|
|
136
182
|
describe "request_host" do
|
data/spec/octokit_spec.rb
CHANGED
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: 1.
|
4
|
+
version: 1.20.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-12-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: addressable
|
@@ -93,6 +93,22 @@ dependencies:
|
|
93
93
|
- - ~>
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '1.3'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: netrc
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.7.7
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ~>
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.7.7
|
96
112
|
- !ruby/object:Gem::Dependency
|
97
113
|
name: json
|
98
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,7 +126,7 @@ dependencies:
|
|
110
126
|
- !ruby/object:Gem::Version
|
111
127
|
version: '1.7'
|
112
128
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
129
|
+
name: kramdown
|
114
130
|
requirement: !ruby/object:Gem::Requirement
|
115
131
|
none: false
|
116
132
|
requirements:
|
@@ -235,6 +251,7 @@ files:
|
|
235
251
|
- lib/octokit/client/emojis.rb
|
236
252
|
- lib/octokit/client/events.rb
|
237
253
|
- lib/octokit/client/gists.rb
|
254
|
+
- lib/octokit/client/gitignore.rb
|
238
255
|
- lib/octokit/client/issues.rb
|
239
256
|
- lib/octokit/client/labels.rb
|
240
257
|
- lib/octokit/client/markdown.rb
|
@@ -260,6 +277,9 @@ files:
|
|
260
277
|
- lib/octokit/version.rb
|
261
278
|
- octokit.gemspec
|
262
279
|
- spec/faraday/response_spec.rb
|
280
|
+
- spec/fixtures/.netrc
|
281
|
+
- spec/fixtures/all_repositories.json
|
282
|
+
- spec/fixtures/all_users.json
|
263
283
|
- spec/fixtures/authorization.json
|
264
284
|
- spec/fixtures/authorizations.json
|
265
285
|
- spec/fixtures/blob.json
|
@@ -292,6 +312,8 @@ files:
|
|
292
312
|
- spec/fixtures/gist_comment_update.json
|
293
313
|
- spec/fixtures/gist_comments.json
|
294
314
|
- spec/fixtures/gists.json
|
315
|
+
- spec/fixtures/gitignore_template_ruby.json
|
316
|
+
- spec/fixtures/gitignore_templates.json
|
295
317
|
- spec/fixtures/hook.json
|
296
318
|
- spec/fixtures/hooks.json
|
297
319
|
- spec/fixtures/issue.json
|
@@ -337,6 +359,7 @@ files:
|
|
337
359
|
- spec/fixtures/pull_request_files.json
|
338
360
|
- spec/fixtures/pull_request_merged.json
|
339
361
|
- spec/fixtures/pull_requests.json
|
362
|
+
- spec/fixtures/pull_requests_comments.json
|
340
363
|
- spec/fixtures/pull_update.json
|
341
364
|
- spec/fixtures/readme.json
|
342
365
|
- spec/fixtures/ref.json
|
@@ -349,6 +372,7 @@ files:
|
|
349
372
|
- spec/fixtures/repo_issues_events.json
|
350
373
|
- spec/fixtures/repositories.json
|
351
374
|
- spec/fixtures/repository.json
|
375
|
+
- spec/fixtures/repository_issues_comments.json
|
352
376
|
- spec/fixtures/repository_notifications.json
|
353
377
|
- spec/fixtures/say.txt
|
354
378
|
- spec/fixtures/say_custom.txt
|
@@ -383,6 +407,7 @@ files:
|
|
383
407
|
- spec/octokit/client/emojis_spec.rb
|
384
408
|
- spec/octokit/client/events_spec.rb
|
385
409
|
- spec/octokit/client/gists_spec.rb
|
410
|
+
- spec/octokit/client/gitignore_spec.rb
|
386
411
|
- spec/octokit/client/issue_events_spec.rb
|
387
412
|
- spec/octokit/client/issues_spec.rb
|
388
413
|
- spec/octokit/client/labels_spec.rb
|
@@ -430,6 +455,9 @@ specification_version: 3
|
|
430
455
|
summary: Simple wrapper for the GitHub v3 API
|
431
456
|
test_files:
|
432
457
|
- spec/faraday/response_spec.rb
|
458
|
+
- spec/fixtures/.netrc
|
459
|
+
- spec/fixtures/all_repositories.json
|
460
|
+
- spec/fixtures/all_users.json
|
433
461
|
- spec/fixtures/authorization.json
|
434
462
|
- spec/fixtures/authorizations.json
|
435
463
|
- spec/fixtures/blob.json
|
@@ -462,6 +490,8 @@ test_files:
|
|
462
490
|
- spec/fixtures/gist_comment_update.json
|
463
491
|
- spec/fixtures/gist_comments.json
|
464
492
|
- spec/fixtures/gists.json
|
493
|
+
- spec/fixtures/gitignore_template_ruby.json
|
494
|
+
- spec/fixtures/gitignore_templates.json
|
465
495
|
- spec/fixtures/hook.json
|
466
496
|
- spec/fixtures/hooks.json
|
467
497
|
- spec/fixtures/issue.json
|
@@ -507,6 +537,7 @@ test_files:
|
|
507
537
|
- spec/fixtures/pull_request_files.json
|
508
538
|
- spec/fixtures/pull_request_merged.json
|
509
539
|
- spec/fixtures/pull_requests.json
|
540
|
+
- spec/fixtures/pull_requests_comments.json
|
510
541
|
- spec/fixtures/pull_update.json
|
511
542
|
- spec/fixtures/readme.json
|
512
543
|
- spec/fixtures/ref.json
|
@@ -519,6 +550,7 @@ test_files:
|
|
519
550
|
- spec/fixtures/repo_issues_events.json
|
520
551
|
- spec/fixtures/repositories.json
|
521
552
|
- spec/fixtures/repository.json
|
553
|
+
- spec/fixtures/repository_issues_comments.json
|
522
554
|
- spec/fixtures/repository_notifications.json
|
523
555
|
- spec/fixtures/say.txt
|
524
556
|
- spec/fixtures/say_custom.txt
|
@@ -553,6 +585,7 @@ test_files:
|
|
553
585
|
- spec/octokit/client/emojis_spec.rb
|
554
586
|
- spec/octokit/client/events_spec.rb
|
555
587
|
- spec/octokit/client/gists_spec.rb
|
588
|
+
- spec/octokit/client/gitignore_spec.rb
|
556
589
|
- spec/octokit/client/issue_events_spec.rb
|
557
590
|
- spec/octokit/client/issues_spec.rb
|
558
591
|
- spec/octokit/client/labels_spec.rb
|