octokit 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +1 -0
- data/lib/octokit/client/repositories.rb +26 -0
- data/lib/octokit/version.rb +1 -1
- data/spec/fixtures/v3/hook.json +18 -0
- data/spec/fixtures/v3/hooks.json +70 -0
- data/spec/octokit/client/repositories_spec.rb +68 -0
- metadata +30 -26
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
* [1.2.0 - May 17, 2012](https://github.com/pengwynn/octokit/compare/v1.1.1...v1.2.0)
|
3
4
|
* [1.1.1 - May 15, 2012](https://github.com/pengwynn/octokit/compare/v1.1.0...v1.1.1)
|
4
5
|
* [1.1.0 - May 13, 2012](https://github.com/pengwynn/octokit/compare/v1.0.7...v1.1.0)
|
5
6
|
* [1.0.7 - May 11, 2012](https://github.com/pengwynn/octokit/compare/v1.0.6...v1.0.7)
|
@@ -127,6 +127,32 @@ module Octokit
|
|
127
127
|
get "/repos/#{Repository.new repo}/branches", options, 3
|
128
128
|
end
|
129
129
|
|
130
|
+
def hooks(repo, options={})
|
131
|
+
get "/repos/#{Repository.new repo}/hooks", options, 3
|
132
|
+
end
|
133
|
+
|
134
|
+
def hook(repo, id, options={})
|
135
|
+
get "/repos/#{Repository.new repo}/hooks/#{id}", options, 3
|
136
|
+
end
|
137
|
+
|
138
|
+
def create_hook(repo, name, config, options={})
|
139
|
+
options = {:name => name, :config => config, :events => ["push"], :active => true}.merge(options)
|
140
|
+
post "/repos/#{Repository.new repo}/hooks", options, 3
|
141
|
+
end
|
142
|
+
|
143
|
+
def edit_hook(repo, id, name, config, options={})
|
144
|
+
options = {:name => name, :config => config, :events => ["push"], :active => true}.merge(options)
|
145
|
+
patch "/repos/#{Repository.new repo}/hooks/#{id}", options, 3
|
146
|
+
end
|
147
|
+
|
148
|
+
def remove_hook(repo, id, options={})
|
149
|
+
delete "/repos/#{Repository.new repo}/hooks/#{id}", options, 3
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_hook(repo, id, options={})
|
153
|
+
post "/repos/#{Repository.new repo}/hooks/#{id}/test", options, 3
|
154
|
+
end
|
155
|
+
|
130
156
|
# Get all Issue Events for a given Repository
|
131
157
|
#
|
132
158
|
# @param repo [String, Repository, Hash] A GitHub repository
|
data/lib/octokit/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"active": true,
|
3
|
+
"config": {
|
4
|
+
"railsbp_url": "http://railsbp.com",
|
5
|
+
"token": "xAAQZtJhYHGagsed1kYR"
|
6
|
+
},
|
7
|
+
"created_at": "2012-01-23T14:11:50Z",
|
8
|
+
"events": ["push"],
|
9
|
+
"id": 154284,
|
10
|
+
"last_response": {
|
11
|
+
"code": 200,
|
12
|
+
"message": "OK",
|
13
|
+
"status": "ok"
|
14
|
+
},
|
15
|
+
"name": "railsbp",
|
16
|
+
"updated_at": "2012-05-13T13:09:51Z",
|
17
|
+
"url": "https://api.github.com/repos/railsbp/railsbp.com/hooks/154284"
|
18
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
[{
|
2
|
+
"active": true,
|
3
|
+
"config": {
|
4
|
+
"token": "f2a00b0bb2e270afcfeb6659d67c0561",
|
5
|
+
"user": "flyerhzm"
|
6
|
+
},
|
7
|
+
"created_at": "2011-11-28T05:00:58Z",
|
8
|
+
"events": ["push"],
|
9
|
+
"id": 121594,
|
10
|
+
"last_response": {
|
11
|
+
"code": 200,
|
12
|
+
"message": "OK",
|
13
|
+
"status": "ok"
|
14
|
+
},
|
15
|
+
"name": "gemnasium",
|
16
|
+
"updated_at": "2012-05-13T13:09:51Z",
|
17
|
+
"url": "https://api.github.com/repos/railsbp/railsbp.com/hooks/121594"
|
18
|
+
}, {
|
19
|
+
"active": true,
|
20
|
+
"config": {
|
21
|
+
"railsbp_url": "http://railsbp.com",
|
22
|
+
"token": "xAAQZtJhYHGagsed1kYR"
|
23
|
+
},
|
24
|
+
"created_at": "2012-01-23T14:11:50Z",
|
25
|
+
"events": ["push"],
|
26
|
+
"id": 154284,
|
27
|
+
"last_response": {
|
28
|
+
"code": 200,
|
29
|
+
"message": "OK",
|
30
|
+
"status": "ok"
|
31
|
+
},
|
32
|
+
"name": "railsbp",
|
33
|
+
"updated_at": "2012-05-13T13:09:51Z",
|
34
|
+
"url": "https://api.github.com/repos/railsbp/railsbp.com/hooks/154284"
|
35
|
+
}, {
|
36
|
+
"active": true,
|
37
|
+
"config": {
|
38
|
+
"token": "BCxleMW8q0IOCeuBABKAkpcRwMdH7TlNxb3f7R6Tjwk5E4gIDL0nW156xIcz",
|
39
|
+
"user": "flyerhzm"
|
40
|
+
},
|
41
|
+
"created_at": "2012-02-20T06:07:24Z",
|
42
|
+
"events": ["push"],
|
43
|
+
"id": 175702,
|
44
|
+
"last_response": {
|
45
|
+
"code": 200,
|
46
|
+
"message": "OK",
|
47
|
+
"status": "ok"
|
48
|
+
},
|
49
|
+
"name": "travis",
|
50
|
+
"updated_at": "2012-05-13T13:09:52Z",
|
51
|
+
"url": "https://api.github.com/repos/railsbp/railsbp.com/hooks/175702"
|
52
|
+
}, {
|
53
|
+
"active": true,
|
54
|
+
"config": {
|
55
|
+
"content_type": "form",
|
56
|
+
"insecure_ssl": "1",
|
57
|
+
"url": "http://rails-brakeman.com/"
|
58
|
+
},
|
59
|
+
"created_at": "2012-05-14T00:05:41Z",
|
60
|
+
"events": ["push"],
|
61
|
+
"id": 249928,
|
62
|
+
"last_response": {
|
63
|
+
"code": 200,
|
64
|
+
"message": "OK",
|
65
|
+
"status": "ok"
|
66
|
+
},
|
67
|
+
"name": "web",
|
68
|
+
"updated_at": "2012-05-14T00:05:47Z",
|
69
|
+
"url": "https://api.github.com/repos/railsbp/railsbp.com/hooks/249928"
|
70
|
+
}]
|
@@ -316,6 +316,74 @@ describe Octokit::Client::Repositories do
|
|
316
316
|
|
317
317
|
end
|
318
318
|
|
319
|
+
describe ".hooks" do
|
320
|
+
|
321
|
+
it "should return a repository's hooks" do
|
322
|
+
stub_get("/repos/railsbp/railsbp.com/hooks").
|
323
|
+
to_return(:body => fixture("v3/hooks.json"))
|
324
|
+
hooks = @client.hooks("railsbp/railsbp.com")
|
325
|
+
hook = hooks.find { |hook| hook.name == "railsbp" }
|
326
|
+
hook.config.token.should == "xAAQZtJhYHGagsed1kYR"
|
327
|
+
end
|
328
|
+
|
329
|
+
end
|
330
|
+
|
331
|
+
describe ".hook" do
|
332
|
+
|
333
|
+
it "should return a repository's single hook" do
|
334
|
+
stub_get("/repos/railsbp/railsbp.com/hooks/154284").
|
335
|
+
to_return(:body => fixture("v3/hook.json"))
|
336
|
+
hook = @client.hook("railsbp/railsbp.com", 154284)
|
337
|
+
hook.config.token.should == "xAAQZtJhYHGagsed1kYR"
|
338
|
+
end
|
339
|
+
|
340
|
+
end
|
341
|
+
|
342
|
+
describe ".create_hook" do
|
343
|
+
|
344
|
+
it "should create a hook" do
|
345
|
+
stub_post("/repos/railsbp/railsbp.com/hooks").
|
346
|
+
with(:body => {:name => "railsbp", :config => {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"}, :events => ["push"], :active => true}).
|
347
|
+
to_return(:body => fixture("v3/hook.json"))
|
348
|
+
hook = @client.create_hook("railsbp/railsbp.com", "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
349
|
+
hook.id.should == 154284
|
350
|
+
end
|
351
|
+
|
352
|
+
end
|
353
|
+
|
354
|
+
describe ".edit_hook" do
|
355
|
+
|
356
|
+
it "should edit a hook" do
|
357
|
+
stub_patch("/repos/railsbp/railsbp.com/hooks/154284").
|
358
|
+
with(:body => {:name => "railsbp", :config => {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"}, :events => ["push"], :active => true}).
|
359
|
+
to_return(:body => fixture("v3/hook.json"))
|
360
|
+
hook = @client.edit_hook("railsbp/railsbp.com", 154284, "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
361
|
+
hook.id.should == 154284
|
362
|
+
hook.config.token.should == "xAAQZtJhYHGagsed1kYR"
|
363
|
+
end
|
364
|
+
|
365
|
+
end
|
366
|
+
|
367
|
+
describe ".remove_hook" do
|
368
|
+
|
369
|
+
it "should remove a hook" do
|
370
|
+
stub_delete("/repos/railsbp/railsbp.com/hooks/154284").
|
371
|
+
to_return(:status => 204)
|
372
|
+
@client.remove_hook("railsbp/railsbp.com", 154284).should be_nil
|
373
|
+
end
|
374
|
+
|
375
|
+
end
|
376
|
+
|
377
|
+
describe ".test_hook" do
|
378
|
+
|
379
|
+
it "should test a hook" do
|
380
|
+
stub_post("/repos/railsbp/railsbp.com/hooks/154284/test").
|
381
|
+
to_return(:status => 204)
|
382
|
+
@client.test_hook("railsbp/railsbp.com", 154284).should be_nil
|
383
|
+
end
|
384
|
+
|
385
|
+
end
|
386
|
+
|
319
387
|
describe ".events" do
|
320
388
|
|
321
389
|
it "should list event for all issues in a repository" 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.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-05-
|
14
|
+
date: 2012-05-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: addressable
|
18
|
-
requirement: &
|
18
|
+
requirement: &70343270586900 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '2.2'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70343270586900
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
|
-
requirement: &
|
29
|
+
requirement: &70343270582840 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0.8'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70343270582840
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: faraday_middleware
|
40
|
-
requirement: &
|
40
|
+
requirement: &70343270581080 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0.8'
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70343270581080
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: hashie
|
51
|
-
requirement: &
|
51
|
+
requirement: &70343270576360 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: '1.2'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70343270576360
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: multi_json
|
62
|
-
requirement: &
|
62
|
+
requirement: &70343270575460 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: '1.3'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70343270575460
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: json
|
73
|
-
requirement: &
|
73
|
+
requirement: &70343270574580 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: '0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70343270574580
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: maruku
|
84
|
-
requirement: &
|
84
|
+
requirement: &70343270573360 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70343270573360
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: rake
|
95
|
-
requirement: &
|
95
|
+
requirement: &70343270572520 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: '0'
|
101
101
|
type: :development
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70343270572520
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: rspec
|
106
|
-
requirement: &
|
106
|
+
requirement: &70343270571320 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
@@ -111,10 +111,10 @@ dependencies:
|
|
111
111
|
version: '0'
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *70343270571320
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: simplecov
|
117
|
-
requirement: &
|
117
|
+
requirement: &70343270570860 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
120
120
|
- - ! '>='
|
@@ -122,10 +122,10 @@ dependencies:
|
|
122
122
|
version: '0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
|
-
version_requirements: *
|
125
|
+
version_requirements: *70343270570860
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: webmock
|
128
|
-
requirement: &
|
128
|
+
requirement: &70343270570060 !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
131
|
- - ! '>='
|
@@ -133,10 +133,10 @@ dependencies:
|
|
133
133
|
version: '0'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
|
-
version_requirements: *
|
136
|
+
version_requirements: *70343270570060
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: yard
|
139
|
-
requirement: &
|
139
|
+
requirement: &70343270569180 !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
142
142
|
- - ! '>='
|
@@ -144,7 +144,7 @@ dependencies:
|
|
144
144
|
version: '0'
|
145
145
|
type: :development
|
146
146
|
prerelease: false
|
147
|
-
version_requirements: *
|
147
|
+
version_requirements: *70343270569180
|
148
148
|
description: Simple wrapper for the GitHub API (v2 and v3)
|
149
149
|
email:
|
150
150
|
- wynn.netherland@gmail.com
|
@@ -222,6 +222,8 @@ files:
|
|
222
222
|
- spec/fixtures/v3/forks.json
|
223
223
|
- spec/fixtures/v3/gist.json
|
224
224
|
- spec/fixtures/v3/gists.json
|
225
|
+
- spec/fixtures/v3/hook.json
|
226
|
+
- spec/fixtures/v3/hooks.json
|
225
227
|
- spec/fixtures/v3/issue.json
|
226
228
|
- spec/fixtures/v3/issue_closed.json
|
227
229
|
- spec/fixtures/v3/issue_event.json
|
@@ -338,6 +340,8 @@ test_files:
|
|
338
340
|
- spec/fixtures/v3/forks.json
|
339
341
|
- spec/fixtures/v3/gist.json
|
340
342
|
- spec/fixtures/v3/gists.json
|
343
|
+
- spec/fixtures/v3/hook.json
|
344
|
+
- spec/fixtures/v3/hooks.json
|
341
345
|
- spec/fixtures/v3/issue.json
|
342
346
|
- spec/fixtures/v3/issue_closed.json
|
343
347
|
- spec/fixtures/v3/issue_event.json
|