octokit 1.17.1 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,11 +13,12 @@ module Octokit
13
13
  end
14
14
 
15
15
  options = {
16
- :proxy => proxy,
17
16
  :ssl => { :verify => false },
18
17
  :url => url,
19
18
  }
20
19
 
20
+ options[:proxy] = proxy unless proxy.nil?
21
+
21
22
  options.merge!(:params => {:access_token => oauth_token}) if oauthed? && !authenticated?
22
23
  options.merge!(:params => unauthed_rate_limit_params) if !oauthed? && !authenticated? && unauthed_rate_limited?
23
24
 
@@ -1,3 +1,3 @@
1
1
  module Octokit
2
- VERSION = "1.17.1" unless defined?(Octokit::VERSION)
2
+ VERSION = "1.18.0" unless defined?(Octokit::VERSION)
3
3
  end
@@ -0,0 +1,19 @@
1
+ {
2
+ "updated_at": "2012-08-30T13:53:41Z",
3
+ "body": "That was easy..\r\n![Not Bad](http://i.imgur.com/4evZN.jpg)",
4
+ "user": {
5
+ "_links": {
6
+ "self": {
7
+ "href": "https://api.github.com/users/12k"
8
+ }
9
+ },
10
+ "gravatar_id": "483dbc17be3a07e7e0136bef0e341707",
11
+ "login": "12k",
12
+ "url": "https://api.github.com/users/12k",
13
+ "avatar_url": "https://secure.gravatar.com/avatar/483dbc17be3a07e7e0136bef0e341707?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
14
+ "id": 1312973
15
+ },
16
+ "created_at": "2012-08-30T13:53:41Z",
17
+ "url": "https://api.github.com/gists/comments/451398",
18
+ "id": 451398
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "updated_at": "2012-10-13T23:03:57Z",
3
+ "body": "This is very helpful.",
4
+ "user": {
5
+ "gravatar_id": "18c2c44835cc7c5ada7c027f12674714",
6
+ "login": "joeyw",
7
+ "_links": {
8
+ "self": {
9
+ "href": "https://api.github.com/users/joeyw"
10
+ }
11
+ },
12
+ "url": "https://api.github.com/users/joeyw",
13
+ "avatar_url": "https://secure.gravatar.com/avatar/18c2c44835cc7c5ada7c027f12674714?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
14
+ "id": 478247
15
+ },
16
+ "created_at": "2012-10-13T23:03:57Z",
17
+ "url": "https://api.github.com/gists/comments/586399",
18
+ "id": 586399
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "updated_at": "2012-10-13T23:25:50Z",
3
+ "body": ":heart:",
4
+ "user": {
5
+ "avatar_url": "https://secure.gravatar.com/avatar/18c2c44835cc7c5ada7c027f12674714?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
6
+ "gravatar_id": "18c2c44835cc7c5ada7c027f12674714",
7
+ "login": "joeyw",
8
+ "_links": {
9
+ "self": {
10
+ "href": "https://api.github.com/users/joeyw"
11
+ }
12
+ },
13
+ "url": "https://api.github.com/users/joeyw",
14
+ "id": 478247
15
+ },
16
+ "created_at": "2012-10-13T23:03:57Z",
17
+ "url": "https://api.github.com/gists/comments/586399",
18
+ "id": 586399
19
+ }
@@ -0,0 +1,40 @@
1
+ [
2
+ {
3
+ "updated_at": "2012-08-30T13:53:41Z",
4
+ "body": "That was easy..\r\n![Not Bad](http://i.imgur.com/4evZN.jpg)",
5
+ "user": {
6
+ "_links": {
7
+ "self": {
8
+ "href": "https://api.github.com/users/12k"
9
+ }
10
+ },
11
+ "gravatar_id": "483dbc17be3a07e7e0136bef0e341707",
12
+ "login": "12k",
13
+ "url": "https://api.github.com/users/12k",
14
+ "avatar_url": "https://secure.gravatar.com/avatar/483dbc17be3a07e7e0136bef0e341707?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
15
+ "id": 1312973
16
+ },
17
+ "created_at": "2012-08-30T13:53:41Z",
18
+ "url": "https://api.github.com/gists/comments/451398",
19
+ "id": 451398
20
+ },
21
+ {
22
+ "updated_at": "2012-08-30T18:52:56Z",
23
+ "body": ":sparkles:",
24
+ "user": {
25
+ "_links": {
26
+ "self": {
27
+ "href": "https://api.github.com/users/eriwen"
28
+ }
29
+ },
30
+ "gravatar_id": "bca89ff7612c074bbe1a77d2cf0a4fb0",
31
+ "login": "eriwen",
32
+ "url": "https://api.github.com/users/eriwen",
33
+ "avatar_url": "https://secure.gravatar.com/avatar/bca89ff7612c074bbe1a77d2cf0a4fb0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
34
+ "id": 51534
35
+ },
36
+ "created_at": "2012-08-30T18:52:56Z",
37
+ "url": "https://api.github.com/gists/comments/458664",
38
+ "id": 458664
39
+ }
40
+ ]
@@ -0,0 +1,138 @@
1
+ {
2
+ "_links": {
3
+ "comments": {
4
+ "href": "https://api.github.com/repos/ctshryock/octokit/issues/15/comments"
5
+ },
6
+ "html": {
7
+ "href": "https://github.com/ctshryock/octokit/pull/15"
8
+ },
9
+ "review_comments": {
10
+ "href": "https://api.github.com/repos/ctshryock/octokit/pulls/15/comments"
11
+ },
12
+ "self": {
13
+ "href": "https://api.github.com/repos/ctshryock/octokit/pulls/15"
14
+ }
15
+ },
16
+ "additions": 5015,
17
+ "base": {
18
+ "label": "ctshryock:master",
19
+ "ref": "master",
20
+ "repo": {
21
+ "clone_url": "https://github.com/ctshryock/octokit.git",
22
+ "created_at": "2011-04-29T18:43:10Z",
23
+ "description": "Simple Ruby wrapper for the GitHub v2 API and feeds",
24
+ "fork": true,
25
+ "forks": 0,
26
+ "git_url": "git://github.com/ctshryock/octokit.git",
27
+ "has_downloads": true,
28
+ "has_issues": true,
29
+ "has_wiki": true,
30
+ "homepage": "",
31
+ "html_url": "https://github.com/ctshryock/octokit",
32
+ "id": 1682040,
33
+ "language": "Ruby",
34
+ "master_branch": null,
35
+ "mirror_url": null,
36
+ "name": "octokit",
37
+ "open_issues": 1,
38
+ "owner": {
39
+ "avatar_url": "https://secure.gravatar.com/avatar/dfb3948650131e4f0385c3328187cfca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
40
+ "gravatar_id": "dfb3948650131e4f0385c3328187cfca",
41
+ "id": 61721,
42
+ "login": "ctshryock",
43
+ "url": "https://api.github.com/users/ctshryock"
44
+ },
45
+ "private": false,
46
+ "pushed_at": "2012-02-11T16:06:32Z",
47
+ "size": 140,
48
+ "ssh_url": "git@github.com:ctshryock/octokit.git",
49
+ "svn_url": "https://github.com/ctshryock/octokit",
50
+ "updated_at": "2012-02-11T16:06:34Z",
51
+ "url": "https://api.github.com/repos/ctshryock/octokit",
52
+ "watchers": 1
53
+ },
54
+ "sha": "89e255143524b71bd91f51d2ca31b7e8c90f398c",
55
+ "user": {
56
+ "avatar_url": "https://secure.gravatar.com/avatar/dfb3948650131e4f0385c3328187cfca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
57
+ "gravatar_id": "dfb3948650131e4f0385c3328187cfca",
58
+ "id": 61721,
59
+ "login": "ctshryock",
60
+ "url": "https://api.github.com/users/ctshryock"
61
+ }
62
+ },
63
+ "body": "Updated body",
64
+ "changed_files": 15,
65
+ "closed_at": null,
66
+ "comments": 0,
67
+ "commits": 19,
68
+ "created_at": "2012-02-11T16:12:31Z",
69
+ "deletions": 112,
70
+ "diff_url": "https://github.com/ctshryock/octokit/pull/15.diff",
71
+ "head": {
72
+ "label": "ctshryock:api-version-3",
73
+ "ref": "api-version-3",
74
+ "repo": {
75
+ "clone_url": "https://github.com/ctshryock/octokit.git",
76
+ "created_at": "2011-04-29T18:43:10Z",
77
+ "description": "Simple Ruby wrapper for the GitHub v2 API and feeds",
78
+ "fork": true,
79
+ "forks": 0,
80
+ "git_url": "git://github.com/ctshryock/octokit.git",
81
+ "has_downloads": true,
82
+ "has_issues": true,
83
+ "has_wiki": true,
84
+ "homepage": "",
85
+ "html_url": "https://github.com/ctshryock/octokit",
86
+ "id": 1682040,
87
+ "language": "Ruby",
88
+ "master_branch": null,
89
+ "mirror_url": null,
90
+ "name": "octokit",
91
+ "open_issues": 1,
92
+ "owner": {
93
+ "avatar_url": "https://secure.gravatar.com/avatar/dfb3948650131e4f0385c3328187cfca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
94
+ "gravatar_id": "dfb3948650131e4f0385c3328187cfca",
95
+ "id": 61721,
96
+ "login": "ctshryock",
97
+ "url": "https://api.github.com/users/ctshryock"
98
+ },
99
+ "private": false,
100
+ "pushed_at": "2012-02-11T16:06:32Z",
101
+ "size": 140,
102
+ "ssh_url": "git@github.com:ctshryock/octokit.git",
103
+ "svn_url": "https://github.com/ctshryock/octokit",
104
+ "updated_at": "2012-02-11T16:06:34Z",
105
+ "url": "https://api.github.com/repos/ctshryock/octokit",
106
+ "watchers": 1
107
+ },
108
+ "sha": "3a3a3ca7ca0ca0026fca1bccfb090b4113a7e754",
109
+ "user": {
110
+ "avatar_url": "https://secure.gravatar.com/avatar/dfb3948650131e4f0385c3328187cfca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
111
+ "gravatar_id": "dfb3948650131e4f0385c3328187cfca",
112
+ "id": 61721,
113
+ "login": "ctshryock",
114
+ "url": "https://api.github.com/users/ctshryock"
115
+ }
116
+ },
117
+ "html_url": "https://github.com/ctshryock/octokit/pull/15",
118
+ "id": 815669,
119
+ "issue_url": "https://github.com/ctshryock/octokit/issues/15",
120
+ "mergeable": null,
121
+ "merged": false,
122
+ "merged_at": null,
123
+ "merged_by": null,
124
+ "number": 15,
125
+ "patch_url": "https://github.com/ctshryock/octokit/pull/15.patch",
126
+ "review_comments": 0,
127
+ "state": "closed",
128
+ "title": "New title",
129
+ "updated_at": "2012-02-11T16:12:31Z",
130
+ "url": "https://api.github.com/repos/ctshryock/octokit/pulls/15",
131
+ "user": {
132
+ "avatar_url": "https://secure.gravatar.com/avatar/dfb3948650131e4f0385c3328187cfca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
133
+ "gravatar_id": "dfb3948650131e4f0385c3328187cfca",
134
+ "id": 61721,
135
+ "login": "ctshryock",
136
+ "url": "https://api.github.com/users/ctshryock"
137
+ }
138
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "tagger": {
3
+ "date": "2012-06-03T17:03:11-07:00",
4
+ "name": "Wynn Netherland",
5
+ "email": "wynn.netherland@gmail.com"
6
+ },
7
+ "message": "Version 1.4.0\n",
8
+ "object": {
9
+ "type": "commit",
10
+ "url": "https://api.github.com/repos/pengwynn/octokit/git/commits/f4cdf6eb734f32343ce3f27670c17b35f54fd82e",
11
+ "sha": "f4cdf6eb734f32343ce3f27670c17b35f54fd82e"
12
+ },
13
+ "url": "https://api.github.com/repos/pengwynn/octokit/git/tags/23aad20633f4d2981b1c7209a800db3014774e96",
14
+ "sha": "23aad20633f4d2981b1c7209a800db3014774e96",
15
+ "tag": "v1.4.0"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "tagger": {
3
+ "date": "2012-06-03T17:03:11-07:00",
4
+ "name": "Wynn Netherland",
5
+ "email": "wynn.netherland@gmail.com"
6
+ },
7
+ "message": "Version 9000\n",
8
+ "object": {
9
+ "type": "commit",
10
+ "url": "https://api.github.com/repos/pengwynn/octokit/git/commits/f4cdf6eb734f32343ce3f27670c17b35f54fd82e",
11
+ "sha": "f4cdf6eb734f32343ce3f27670c17b35f54fd82e"
12
+ },
13
+ "url": "https://api.github.com/repos/pengwynn/octokit/git/tags/23aad20633f4d2981b1c7209a800db3014774e96",
14
+ "sha": "23aad20633f4d2981b1c7209a800db3014774e96",
15
+ "tag": "v9000.0.0"
16
+ }
@@ -130,4 +130,49 @@ describe Octokit::Client::Gists do
130
130
  end
131
131
  end
132
132
 
133
+ describe ".gist_comments" do
134
+ it "returns the list of gist comments" do
135
+ stub_get("/gists/12345/comments").
136
+ to_return(:body => fixture("v3/gist_comments.json"))
137
+ comments = @client.gist_comments(12345)
138
+ expect(comments.first.id).to eq(451398)
139
+ end
140
+ end
141
+
142
+ describe ".gist_comment" do
143
+ it "returns a gist comment" do
144
+ stub_get("/gists/comments/12345").
145
+ to_return(:body => fixture("v3/gist_comment.json"))
146
+ comment = @client.gist_comment(12345)
147
+ expect(comment.id).to eq(451398)
148
+ end
149
+ end
150
+
151
+ describe ".create_gist_comment" do
152
+ it "creates a gist comment" do
153
+ stub_post("/gists/12345/comments").
154
+ to_return(:body => fixture("v3/gist_comment_create.json"))
155
+ comment = @client.create_gist_comment(12345, "This is very helpful.")
156
+ expect(comment.id).to eq(586399)
157
+ expect(comment.body).to eq("This is very helpful.")
158
+ end
159
+ end
160
+
161
+ describe ".update_gist_comment" do
162
+ it "updates a gist comment" do
163
+ stub_patch("/gists/comments/12345").
164
+ to_return(:body => fixture("v3/gist_comment_update.json"))
165
+ comment = @client.update_gist_comment(12345, ":heart:")
166
+ expect(comment.body).to eq(":heart:")
167
+ end
168
+ end
169
+
170
+ describe ".delete_gist_comment" do
171
+ it "deletes a gist comment" do
172
+ stub_delete("/gists/comments/12345").to_return(:status => 204)
173
+ result = @client.delete_gist_comment(12345)
174
+ expect(result).to be_true
175
+ end
176
+ end
177
+
133
178
  end
@@ -58,4 +58,52 @@ describe Octokit::Client::Objects do
58
58
 
59
59
  end
60
60
 
61
+ describe ".tag" do
62
+
63
+ it "returns a tag" do
64
+ stub_get("/repos/pengwynn/octokit/git/tags/23aad20633f4d2981b1c7209a800db3014774e96").
65
+ to_return(:body => fixture("v3/tag.json"))
66
+ tag = @client.tag("pengwynn/octokit", "23aad20633f4d2981b1c7209a800db3014774e96")
67
+ expect(tag.sha).to eq("23aad20633f4d2981b1c7209a800db3014774e96")
68
+ expect(tag.message).to eq("Version 1.4.0\n")
69
+ expect(tag.tag).to eq("v1.4.0")
70
+ end
71
+
72
+ end
73
+
74
+ describe ".create_tag" do
75
+
76
+ it "creates a tag" do
77
+ stub_post("/repos/pengwynn/octokit/git/tags").
78
+ with(:body => {
79
+ :tag => "v9000.0.0",
80
+ :message => "Version 9000\n",
81
+ :object => "f4cdf6eb734f32343ce3f27670c17b35f54fd82e",
82
+ :type => "commit",
83
+ :tagger => {
84
+ :name => "Wynn Netherland",
85
+ :email => "wynn.netherland@gmail.com",
86
+ :date => "2012-06-03T17:03:11-07:00"
87
+ }
88
+ },
89
+ :headers => { "Content-Type" => "application/json" }).
90
+ to_return(:body => fixture("v3/tag_create.json"))
91
+ tag = @client.create_tag(
92
+ "pengwynn/octokit",
93
+ "v9000.0.0",
94
+ "Version 9000\n",
95
+ "f4cdf6eb734f32343ce3f27670c17b35f54fd82e",
96
+ "commit",
97
+ "Wynn Netherland",
98
+ "wynn.netherland@gmail.com",
99
+ "2012-06-03T17:03:11-07:00"
100
+ )
101
+ expect(tag.tag).to eq("v9000.0.0")
102
+ expect(tag.message).to eq("Version 9000\n")
103
+ expect(tag.sha).to eq("23aad20633f4d2981b1c7209a800db3014774e96")
104
+ end
105
+
106
+ end
107
+
108
+
61
109
  end
@@ -20,6 +20,20 @@ describe Octokit::Client::Pulls do
20
20
 
21
21
  end
22
22
 
23
+ describe ".update_pull_request" do
24
+
25
+ it "updates a pull request" do
26
+ stub_post("https://api.github.com/repos/pengwynn/octokit/pulls/67").
27
+ with(:pull => { :title => "New title", :body => "Updated body", :state => "closed"}).
28
+ to_return(:body => fixture('v3/pull_update.json'))
29
+ pull = @client.update_pull_request('pengwynn/octokit', 67, 'New title', 'Updated body', 'closed')
30
+ expect(pull.title).to eq('New title')
31
+ expect(pull.body).to eq('Updated body')
32
+ expect(pull.state).to eq('closed')
33
+ end
34
+
35
+ end
36
+
23
37
  describe ".create_pull_request_for_issue" do
24
38
 
25
39
  it "creates a pull request and attach it to an existing issue" do
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.17.1
4
+ version: 1.18.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-10-11 00:00:00.000000000 Z
14
+ date: 2012-10-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: addressable
@@ -287,6 +287,10 @@ files:
287
287
  - spec/fixtures/v3/following.json
288
288
  - spec/fixtures/v3/forks.json
289
289
  - spec/fixtures/v3/gist.json
290
+ - spec/fixtures/v3/gist_comment.json
291
+ - spec/fixtures/v3/gist_comment_create.json
292
+ - spec/fixtures/v3/gist_comment_update.json
293
+ - spec/fixtures/v3/gist_comments.json
290
294
  - spec/fixtures/v3/gists.json
291
295
  - spec/fixtures/v3/hook.json
292
296
  - spec/fixtures/v3/hooks.json
@@ -322,6 +326,7 @@ files:
322
326
  - spec/fixtures/v3/pull_request_files.json
323
327
  - spec/fixtures/v3/pull_request_merged.json
324
328
  - spec/fixtures/v3/pull_requests.json
329
+ - spec/fixtures/v3/pull_update.json
325
330
  - spec/fixtures/v3/readme.json
326
331
  - spec/fixtures/v3/ref.json
327
332
  - spec/fixtures/v3/ref_create.json
@@ -338,6 +343,8 @@ files:
338
343
  - spec/fixtures/v3/starred_gists.json
339
344
  - spec/fixtures/v3/status.json
340
345
  - spec/fixtures/v3/statuses.json
346
+ - spec/fixtures/v3/tag.json
347
+ - spec/fixtures/v3/tag_create.json
341
348
  - spec/fixtures/v3/tags.json
342
349
  - spec/fixtures/v3/team.json
343
350
  - spec/fixtures/v3/teams.json
@@ -429,6 +436,10 @@ test_files:
429
436
  - spec/fixtures/v3/following.json
430
437
  - spec/fixtures/v3/forks.json
431
438
  - spec/fixtures/v3/gist.json
439
+ - spec/fixtures/v3/gist_comment.json
440
+ - spec/fixtures/v3/gist_comment_create.json
441
+ - spec/fixtures/v3/gist_comment_update.json
442
+ - spec/fixtures/v3/gist_comments.json
432
443
  - spec/fixtures/v3/gists.json
433
444
  - spec/fixtures/v3/hook.json
434
445
  - spec/fixtures/v3/hooks.json
@@ -464,6 +475,7 @@ test_files:
464
475
  - spec/fixtures/v3/pull_request_files.json
465
476
  - spec/fixtures/v3/pull_request_merged.json
466
477
  - spec/fixtures/v3/pull_requests.json
478
+ - spec/fixtures/v3/pull_update.json
467
479
  - spec/fixtures/v3/readme.json
468
480
  - spec/fixtures/v3/ref.json
469
481
  - spec/fixtures/v3/ref_create.json
@@ -480,6 +492,8 @@ test_files:
480
492
  - spec/fixtures/v3/starred_gists.json
481
493
  - spec/fixtures/v3/status.json
482
494
  - spec/fixtures/v3/statuses.json
495
+ - spec/fixtures/v3/tag.json
496
+ - spec/fixtures/v3/tag_create.json
483
497
  - spec/fixtures/v3/tags.json
484
498
  - spec/fixtures/v3/team.json
485
499
  - spec/fixtures/v3/teams.json