github_api 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/features/gists/comments.feature +8 -8
- data/lib/github_api/gists/comments.rb +15 -15
- data/lib/github_api/repos.rb +3 -1
- data/lib/github_api/repos/comments.rb +6 -5
- data/lib/github_api/requestable.rb +67 -0
- data/lib/github_api/version.rb +1 -1
- data/spec/github/activity/activity_spec.rb +2 -0
- data/spec/github/activity/events/issue_spec.rb +8 -20
- data/spec/github/activity/events/network_spec.rb +8 -20
- data/spec/github/activity/events/org_spec.rb +8 -18
- data/spec/github/activity/events/performed_spec.rb +13 -31
- data/spec/github/activity/events/public_spec.rb +7 -18
- data/spec/github/activity/events/received_spec.rb +12 -31
- data/spec/github/activity/events/repository_spec.rb +8 -20
- data/spec/github/activity/events/user_org_spec.rb +8 -20
- data/spec/github/activity/notifications/list_spec.rb +4 -11
- data/spec/github/activity/starring/list_spec.rb +8 -21
- data/spec/github/activity/watching/list_spec.rb +4 -18
- data/spec/github/gists/comments_spec.rb +24 -23
- data/spec/github/git_data/blobs/create_spec.rb +62 -0
- data/spec/github/git_data/blobs/get_spec.rb +49 -0
- data/spec/github/git_data/blobs_spec.rb +0 -116
- data/spec/github/repos/branch_spec.rb +3 -9
- data/spec/github/repos/branches_spec.rb +5 -13
- data/spec/github/repos/collaborators/add_spec.rb +37 -0
- data/spec/github/repos/collaborators/get_spec.rb +51 -0
- data/spec/github/repos/collaborators/list_spec.rb +51 -0
- data/spec/github/repos/collaborators/remove_spec.rb +37 -0
- data/spec/github/repos/collaborators_spec.rb +1 -176
- data/spec/github/repos/comments/create_spec.rb +2 -33
- data/spec/github/repos/comments/delete_spec.rb +3 -9
- data/spec/github/repos/comments/get_spec.rb +3 -9
- data/spec/github/repos/comments/list_spec.rb +16 -40
- data/spec/github/repos/comments/update_spec.rb +5 -11
- data/spec/github/repos/commits/get_spec.rb +3 -9
- data/spec/github/repos/commits/list_spec.rb +9 -20
- data/spec/github/repos/contributors_spec.rb +5 -13
- data/spec/github/repos/delete_spec.rb +3 -8
- data/spec/github/repos/downloads/create_spec.rb +3 -9
- data/spec/github/repos/downloads/delete_spec.rb +3 -9
- data/spec/github/repos/downloads/get_spec.rb +5 -12
- data/spec/github/repos/downloads/list_spec.rb +8 -18
- data/spec/github/repos/edit_spec.rb +3 -9
- data/spec/github/repos/forks/create_spec.rb +3 -9
- data/spec/github/repos/forks/list_spec.rb +8 -21
- data/spec/github/repos/get_spec.rb +3 -9
- data/spec/github/repos/list_spec.rb +8 -7
- data/spec/github/repos_spec.rb +2 -0
- data/spec/shared/api_interface_behaviour.rb +15 -0
- data/spec/shared/array_of_resources_behaviour.rb +15 -0
- data/spec/shared/request_failure_behaviour.rb +16 -0
- data/spec/spec_helper.rb +1 -1
- metadata +43 -33
@@ -36,14 +36,8 @@ describe Github::Repos::Forks, '#create' do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
|
-
let(:
|
41
|
-
let(:status) { 404 }
|
42
|
-
|
43
|
-
it "should faile to retrieve resource" do
|
44
|
-
expect {
|
45
|
-
subject.create user, repo, inputs
|
46
|
-
}.to raise_error(Github::Error::NotFound)
|
47
|
-
end
|
39
|
+
it_should_behave_like 'request failure' do
|
40
|
+
let(:requestable) { subject.create user, repo, inputs }
|
48
41
|
end
|
42
|
+
|
49
43
|
end # create
|
@@ -14,7 +14,6 @@ describe Github::Repos::Forks, '#list' do
|
|
14
14
|
|
15
15
|
after { reset_authentication_for(subject) }
|
16
16
|
|
17
|
-
|
18
17
|
context "resource found" do
|
19
18
|
let(:body) { fixture('repos/forks.json') }
|
20
19
|
let(:status) { 200 }
|
@@ -30,15 +29,8 @@ describe Github::Repos::Forks, '#list' do
|
|
30
29
|
a_get(request_path).should have_been_made
|
31
30
|
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
forks.should be_an Array
|
36
|
-
forks.should have(1).items
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should be a mash type" do
|
40
|
-
forks = subject.list user, repo
|
41
|
-
forks.first.should be_a Hashie::Mash
|
32
|
+
it_should_behave_like 'an array of resources' do
|
33
|
+
let(:requestable) { subject.list user, repo }
|
42
34
|
end
|
43
35
|
|
44
36
|
it "should get fork information" do
|
@@ -47,19 +39,14 @@ describe Github::Repos::Forks, '#list' do
|
|
47
39
|
end
|
48
40
|
|
49
41
|
it "should yield to a block" do
|
50
|
-
|
51
|
-
subject.list(user, repo) { |
|
42
|
+
yielded = []
|
43
|
+
result = subject.list(user, repo) { |obj| yielded << obj }
|
44
|
+
yielded.should == result
|
52
45
|
end
|
53
46
|
end
|
54
47
|
|
55
|
-
|
56
|
-
let(:
|
57
|
-
let(:status) { [404, "Not Found"] }
|
58
|
-
|
59
|
-
it "should return 404 with a message 'Not Found'" do
|
60
|
-
expect {
|
61
|
-
subject.list user, repo
|
62
|
-
}.to raise_error(Github::Error::NotFound)
|
63
|
-
end
|
48
|
+
it_should_behave_like 'request failure' do
|
49
|
+
let(:requestable) { subject.list user, repo }
|
64
50
|
end
|
51
|
+
|
65
52
|
end # list
|
@@ -44,14 +44,8 @@ describe Github::Repos, '#get' do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
let(:
|
49
|
-
let(:status) { 404 }
|
50
|
-
|
51
|
-
it "should fail to get resource" do
|
52
|
-
expect {
|
53
|
-
subject.get user, repo
|
54
|
-
}.to raise_error(Github::Error::NotFound)
|
55
|
-
end
|
47
|
+
it_should_behave_like 'request failure' do
|
48
|
+
let(:requestable) { subject.get user, repo }
|
56
49
|
end
|
50
|
+
|
57
51
|
end # get
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Github::Repos, '#list' do
|
6
|
+
include Github::Jsonable
|
7
|
+
|
6
8
|
let(:user) { 'peter-murach' }
|
7
9
|
let(:repo) { 'github' }
|
8
10
|
let(:request_path) { "/user/repos?access_token=#{OAUTH_TOKEN}" }
|
@@ -34,10 +36,8 @@ describe Github::Repos, '#list' do
|
|
34
36
|
a_get(request_path).should have_been_made
|
35
37
|
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
repositories.should be_an Array
|
40
|
-
repositories.should have(1).items
|
39
|
+
it_should_behave_like 'an array of resources' do
|
40
|
+
let(:requestable) { subject.list }
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should return array of resources sorted by pushed_at time" do
|
@@ -50,9 +50,10 @@ describe Github::Repos, '#list' do
|
|
50
50
|
repositories.first.name.should == 'Hello-World'
|
51
51
|
end
|
52
52
|
|
53
|
-
it "should yield
|
54
|
-
|
55
|
-
subject.list { |
|
53
|
+
it "should yield result to a block" do
|
54
|
+
yielded = []
|
55
|
+
result = subject.list { |obj| yielded << obj }
|
56
|
+
yielded.should == result
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
data/spec/github/repos_spec.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
shared_examples_for 'api interface' do
|
4
|
+
|
5
|
+
it { should respond_to :endpoint }
|
6
|
+
|
7
|
+
it { should respond_to :site }
|
8
|
+
|
9
|
+
it { should respond_to :user }
|
10
|
+
|
11
|
+
it { should respond_to :repo }
|
12
|
+
|
13
|
+
it { should respond_to :adapter }
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
shared_examples_for 'an array of resources' do
|
4
|
+
|
5
|
+
it "should return array of resources" do
|
6
|
+
objects = requestable
|
7
|
+
objects.should be_an Array
|
8
|
+
objects.should have(1).items
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be a mash type" do
|
12
|
+
objects = requestable
|
13
|
+
objects.first.should be_a Hashie::Mash
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
shared_examples_for 'request failure' do
|
4
|
+
|
5
|
+
context "resource not found" do
|
6
|
+
let(:body) { "" }
|
7
|
+
let(:status) { [404, "Not Found"] }
|
8
|
+
|
9
|
+
it "should fail to retrive resource" do
|
10
|
+
expect {
|
11
|
+
requestable
|
12
|
+
}.to raise_error(Github::Error::NotFound)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -16,7 +16,7 @@ end
|
|
16
16
|
|
17
17
|
# Requires supporting files with custom matchers and macros, etc,
|
18
18
|
# in ./support/ and its subdirectories.
|
19
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
19
|
+
Dir["#{File.dirname(__FILE__)}/{support,shared}/**/*.rb"].each { |f| require f }
|
20
20
|
|
21
21
|
module Github
|
22
22
|
def reset!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-17 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &2154232220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2154232220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &2154231720 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2154231720
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: multi_json
|
38
|
-
requirement: &
|
38
|
+
requirement: &2154231260 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '1.3'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2154231260
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: oauth2
|
49
|
-
requirement: &
|
49
|
+
requirement: &2154230880 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2154230880
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &2154230340 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.5.2
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2154230340
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &2154229840 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2154229840
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: cucumber
|
82
|
-
requirement: &
|
82
|
+
requirement: &2154229380 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2154229380
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: webmock
|
93
|
-
requirement: &
|
93
|
+
requirement: &2154228920 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.8.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2154228920
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: vcr
|
104
|
-
requirement: &
|
104
|
+
requirement: &2154228460 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 2.3.0
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2154228460
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: simplecov
|
115
|
-
requirement: &
|
115
|
+
requirement: &2154228000 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 0.7.1
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *2154228000
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: guard
|
126
|
-
requirement: &
|
126
|
+
requirement: &2154227620 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *2154227620
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: guard-rspec
|
137
|
-
requirement: &
|
137
|
+
requirement: &2154227160 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *2154227160
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: guard-cucumber
|
148
|
-
requirement: &
|
148
|
+
requirement: &2154226740 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *2154226740
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: rake
|
159
|
-
requirement: &
|
159
|
+
requirement: &2154226320 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,10 @@ dependencies:
|
|
164
164
|
version: '0'
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *2154226320
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: bundler
|
170
|
-
requirement: &
|
170
|
+
requirement: &2154242280 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,7 +175,7 @@ dependencies:
|
|
175
175
|
version: '0'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *2154242280
|
179
179
|
description: ! ' Ruby wrapper that supports all of the GitHub API v3 methods(nearly
|
180
180
|
200). It''s build in a modular way, that is, you can either instantiate the whole
|
181
181
|
api wrapper Github.new or use parts of it e.i. Github::Repos.new if working solely
|
@@ -383,6 +383,7 @@ files:
|
|
383
383
|
- lib/github_api/request/jsonize.rb
|
384
384
|
- lib/github_api/request/oauth2.rb
|
385
385
|
- lib/github_api/request.rb
|
386
|
+
- lib/github_api/requestable.rb
|
386
387
|
- lib/github_api/resource.rb
|
387
388
|
- lib/github_api/response/helpers.rb
|
388
389
|
- lib/github_api/response/jsonize.rb
|
@@ -532,6 +533,8 @@ files:
|
|
532
533
|
- spec/github/error/validations_spec.rb
|
533
534
|
- spec/github/gists/comments_spec.rb
|
534
535
|
- spec/github/gists_spec.rb
|
536
|
+
- spec/github/git_data/blobs/create_spec.rb
|
537
|
+
- spec/github/git_data/blobs/get_spec.rb
|
535
538
|
- spec/github/git_data/blobs_spec.rb
|
536
539
|
- spec/github/git_data/commits_spec.rb
|
537
540
|
- spec/github/git_data/references_spec.rb
|
@@ -557,6 +560,10 @@ files:
|
|
557
560
|
- spec/github/pull_requests_spec.rb
|
558
561
|
- spec/github/repos/branch_spec.rb
|
559
562
|
- spec/github/repos/branches_spec.rb
|
563
|
+
- spec/github/repos/collaborators/add_spec.rb
|
564
|
+
- spec/github/repos/collaborators/get_spec.rb
|
565
|
+
- spec/github/repos/collaborators/list_spec.rb
|
566
|
+
- spec/github/repos/collaborators/remove_spec.rb
|
560
567
|
- spec/github/repos/collaborators_spec.rb
|
561
568
|
- spec/github/repos/comments/create_spec.rb
|
562
569
|
- spec/github/repos/comments/delete_spec.rb
|
@@ -610,6 +617,9 @@ files:
|
|
610
617
|
- spec/github/validations_spec.rb
|
611
618
|
- spec/github_spec.rb
|
612
619
|
- spec/README.rdoc
|
620
|
+
- spec/shared/api_interface_behaviour.rb
|
621
|
+
- spec/shared/array_of_resources_behaviour.rb
|
622
|
+
- spec/shared/request_failure_behaviour.rb
|
613
623
|
- spec/spec_helper.rb
|
614
624
|
- spec/support/authentication.rb
|
615
625
|
- spec/support/base.rb
|
@@ -619,7 +629,7 @@ files:
|
|
619
629
|
homepage: https://github.com/peter-murach/github
|
620
630
|
licenses: []
|
621
631
|
post_install_message: ! "\n--------------------------------------------------------------------------------\nThank
|
622
|
-
you for installing github_api-0.8.
|
632
|
+
you for installing github_api-0.8.1.\n\nFor more information: https://github.com/peter-murach/github\n--------------------------------------------------------------------------------\n
|
623
633
|
\ "
|
624
634
|
rdoc_options: []
|
625
635
|
require_paths:
|