github_api 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/github_api/activity/events.rb +10 -10
- data/lib/github_api/response_wrapper.rb +4 -2
- data/lib/github_api/version.rb +1 -1
- data/spec/github/response_wrapper/eql_spec.rb +92 -0
- data/spec/github/response_wrapper/headers_spec.rb +37 -0
- data/spec/github/response_wrapper_spec.rb +1 -33
- metadata +38 -36
@@ -28,8 +28,8 @@ module Github
|
|
28
28
|
# github.activity.events.repository 'user-name', 'repo-name'
|
29
29
|
# github.activity.events.repository 'user-name', 'repo-name' { |event| ... }
|
30
30
|
#
|
31
|
-
# github.events.repository user: 'user-name', repo: 'repo-name'
|
32
|
-
# github.events.repository user: 'user-name', repo: 'repo-name' {|event| ... }
|
31
|
+
# github.activity.events.repository user: 'user-name', repo: 'repo-name'
|
32
|
+
# github.activity.events.repository user: 'user-name', repo: 'repo-name' {|event| ... }
|
33
33
|
#
|
34
34
|
def repository(*args)
|
35
35
|
arguments(args, :required => [:user, :repo])
|
@@ -50,8 +50,8 @@ module Github
|
|
50
50
|
# github.activity.events.issue 'user-name', 'repo-name'
|
51
51
|
# github.activity.events.issue 'user-name', 'repo-name' { |event| ... }
|
52
52
|
#
|
53
|
-
# github.events.issue user: 'user-name', repo: 'repo-name'
|
54
|
-
# github.events.issue user: 'user-name', repo: 'repo-name' { |event| ... }
|
53
|
+
# github.activity.events.issue user: 'user-name', repo: 'repo-name'
|
54
|
+
# github.activity.events.issue user: 'user-name', repo: 'repo-name' { |event| ... }
|
55
55
|
#
|
56
56
|
def issue(*args)
|
57
57
|
arguments(args, :required => [:user, :repo])
|
@@ -72,8 +72,8 @@ module Github
|
|
72
72
|
# github.activity.events.network 'user-name', 'repo-name'
|
73
73
|
# github.activity.events.network 'user-name', 'repo-name' { |event| ... }
|
74
74
|
#
|
75
|
-
# github.events.network user: 'user-name', repo: 'repo-name'
|
76
|
-
# github.events.network user: 'user-name', repo: 'repo-name' { |event| ... }
|
75
|
+
# github.activity.events.network user: 'user-name', repo: 'repo-name'
|
76
|
+
# github.activity.events.network user: 'user-name', repo: 'repo-name' { |event| ... }
|
77
77
|
#
|
78
78
|
def network(*args)
|
79
79
|
arguments(args, :required => [:user, :repo])
|
@@ -94,8 +94,8 @@ module Github
|
|
94
94
|
# github.activity.events.org 'org-name'
|
95
95
|
# github.activity.events.org 'org-name' { |event| ... }
|
96
96
|
#
|
97
|
-
# github.events.org org: 'org-name'
|
98
|
-
# github.events.org org: 'org-name' { |event| ... }
|
97
|
+
# github.activity.events.org org: 'org-name'
|
98
|
+
# github.activity.events.org org: 'org-name' { |event| ... }
|
99
99
|
#
|
100
100
|
def org(*args)
|
101
101
|
arguments(args, :required => [:org_name])
|
@@ -186,8 +186,8 @@ module Github
|
|
186
186
|
# github.activity.events.user_org 'user-name', 'org-name'
|
187
187
|
# github.activity.events.user_org 'user-name', 'org-name' { |event| ... }
|
188
188
|
#
|
189
|
-
# github.events.user_org user: 'user-name', org_name: 'org-name'
|
190
|
-
# github.events.user_org user: 'user-name', org_name: 'org-name' {|event| ...}
|
189
|
+
# github.activity.events.user_org user: 'user-name', org_name: 'org-name'
|
190
|
+
# github.activity.events.user_org user: 'user-name', org_name: 'org-name' {|event| ...}
|
191
191
|
#
|
192
192
|
def user_org(*args)
|
193
193
|
arguments(args, :required => [:user, :org_name])
|
@@ -139,9 +139,11 @@ module Github
|
|
139
139
|
# Compare the wrapper with other wrapper for equality
|
140
140
|
#
|
141
141
|
def ==(other)
|
142
|
-
|
143
|
-
|
142
|
+
return false unless other.is_a?(self.class)
|
143
|
+
return false unless (other.respond_to?(:env) && other.respond_to?(:body))
|
144
|
+
self.env == other.env && self.body == other.body
|
144
145
|
end
|
146
|
+
alias eql? ==
|
145
147
|
|
146
148
|
end # ResponseWrapper
|
147
149
|
end # Github
|
data/lib/github_api/version.rb
CHANGED
@@ -0,0 +1,92 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Github::ResponseWrapper, '#eql?' do
|
6
|
+
let(:env) {
|
7
|
+
{ :status => 404, :body => 'some',
|
8
|
+
:response_headers => {'Content-Type' => 'text/plain'} }
|
9
|
+
}
|
10
|
+
let(:res) { Faraday::Response.new env }
|
11
|
+
let(:object) { described_class.new res, nil }
|
12
|
+
|
13
|
+
subject { object.eql?(other) }
|
14
|
+
|
15
|
+
context 'with the same object' do
|
16
|
+
let(:other) { object }
|
17
|
+
|
18
|
+
it { expect(object.body).to eql('some') }
|
19
|
+
|
20
|
+
it { should be_true }
|
21
|
+
|
22
|
+
it 'is symmetric' do
|
23
|
+
should eql(other.eql?(object))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'with an equivalent object' do
|
28
|
+
let(:other) { object.dup }
|
29
|
+
|
30
|
+
it { should be_true }
|
31
|
+
|
32
|
+
it 'is symmetric' do
|
33
|
+
should eql(other.eql?(object))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'with object having a nil body' do
|
38
|
+
let(:other_env) { { :body => nil }}
|
39
|
+
let(:other_res) { Faraday::Response.new other_env }
|
40
|
+
let(:other) { described_class.new(other_res, nil) }
|
41
|
+
|
42
|
+
it { expect(other.body).to be_nil }
|
43
|
+
|
44
|
+
it { should be_false }
|
45
|
+
|
46
|
+
it 'is symmetric' do
|
47
|
+
should eql(other.eql?(object))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'with object having different body' do
|
52
|
+
let(:other_env) { { :body => ["some"] }}
|
53
|
+
let(:other_res) { Faraday::Response.new other_env }
|
54
|
+
let(:other) { described_class.new(other_res, nil) }
|
55
|
+
|
56
|
+
it { expect(other.body).to eql(["some"]) }
|
57
|
+
|
58
|
+
it { should be_false }
|
59
|
+
|
60
|
+
it 'is symmetric' do
|
61
|
+
should eql(other.eql?(object))
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'with object having no environment' do
|
66
|
+
let(:other) {
|
67
|
+
::Class.new do
|
68
|
+
def body; ['some'] end
|
69
|
+
end.new
|
70
|
+
}
|
71
|
+
|
72
|
+
it { should be_false }
|
73
|
+
|
74
|
+
it 'is symmetric' do
|
75
|
+
should eql(other.eql?(object))
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'with object having no body' do
|
80
|
+
let(:other) {
|
81
|
+
::Class.new do
|
82
|
+
def env; end
|
83
|
+
end.new
|
84
|
+
}
|
85
|
+
|
86
|
+
it { should be_false }
|
87
|
+
|
88
|
+
it 'is symmetric' do
|
89
|
+
should eql(other.eql?(object))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Github::ResponseWrapper, '#headers' do
|
6
|
+
let(:env) {
|
7
|
+
{ :response_headers => {
|
8
|
+
'Content-Type' => "application/json; charset=utf-8",
|
9
|
+
'X-RateLimit-Remaining' => '4999',
|
10
|
+
'X-RateLimit-Limit' => '5000',
|
11
|
+
'content-length' => '344',
|
12
|
+
'ETag' => "\"d9a88f20567726e29d35c6fae87cef2f\"",
|
13
|
+
'Server' => "nginx/1.0.4",
|
14
|
+
'Date' => "Sun, 05 Feb 2012 15:02:34 GMT",
|
15
|
+
}, :body => ['some'], :status => 200 }
|
16
|
+
}
|
17
|
+
let(:res) { Faraday::Response.new env }
|
18
|
+
let(:object) { described_class.new res, nil }
|
19
|
+
|
20
|
+
subject { object.headers }
|
21
|
+
|
22
|
+
its(:content_type) { should match 'application/json' }
|
23
|
+
|
24
|
+
its(:content_length) { should match '344' }
|
25
|
+
|
26
|
+
its(:ratelimit_limit) { should == '5000' }
|
27
|
+
|
28
|
+
its(:ratelimit_remaining) { should == '4999' }
|
29
|
+
|
30
|
+
its(:status) { should be 200 }
|
31
|
+
|
32
|
+
its(:etag) { should eql "\"d9a88f20567726e29d35c6fae87cef2f\"" }
|
33
|
+
|
34
|
+
its(:date) { should eql "Sun, 05 Feb 2012 15:02:34 GMT" }
|
35
|
+
|
36
|
+
its(:server) { should eql "nginx/1.0.4" }
|
37
|
+
end
|
@@ -44,38 +44,6 @@ describe Github::ResponseWrapper do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
it "should read response content_type " do
|
48
|
-
res.headers.content_type.should match 'application/json'
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should read response content_length " do
|
52
|
-
res.headers.content_length.should match '344'
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should read response ratelimit limit" do
|
56
|
-
res.headers.ratelimit_limit.should == '5000'
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should read response ratelimit remaining" do
|
60
|
-
res.headers.ratelimit_remaining.should == '4999'
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should read response status" do
|
64
|
-
res.headers.status.should be 200
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'should read response etag' do
|
68
|
-
res.headers.etag.should eql "\"d9a88f20567726e29d35c6fae87cef2f\""
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'should read response date' do
|
72
|
-
res.headers.date.should eql "Sun, 05 Feb 2012 15:02:34 GMT"
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'should read response server' do
|
76
|
-
res.headers.server.should eql "nginx/1.0.4"
|
77
|
-
end
|
78
|
-
|
79
47
|
it "should assess successful" do
|
80
48
|
res.success?.should be_true
|
81
49
|
end
|
@@ -133,4 +101,4 @@ describe Github::ResponseWrapper do
|
|
133
101
|
|
134
102
|
end # pagination
|
135
103
|
|
136
|
-
end # Github::
|
104
|
+
end # Github::ResponseWrapper
|
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.9.
|
4
|
+
version: 0.9.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &2161138280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '2
|
21
|
+
version: '1.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2161138280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161137520 !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: *2161137520
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: multi_json
|
38
|
-
requirement: &
|
38
|
+
requirement: &2161137020 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '1.4'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2161137020
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: oauth2
|
49
|
-
requirement: &
|
49
|
+
requirement: &2161136640 !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: *2161136640
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &2161098200 !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: *2161098200
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &2161097440 !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: *2161097440
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: cucumber
|
82
|
-
requirement: &
|
82
|
+
requirement: &2161096720 !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: *2161096720
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: webmock
|
93
|
-
requirement: &
|
93
|
+
requirement: &2161096260 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.9.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2161096260
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: vcr
|
104
|
-
requirement: &
|
104
|
+
requirement: &2161095800 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 2.4.0
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2161095800
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: simplecov
|
115
|
-
requirement: &
|
115
|
+
requirement: &2161095300 !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: *2161095300
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: coveralls
|
126
|
-
requirement: &
|
126
|
+
requirement: &2161094600 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: 0.5.8
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *2161094600
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: guard
|
137
|
-
requirement: &
|
137
|
+
requirement: &2161094040 !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: *2161094040
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: guard-rspec
|
148
|
-
requirement: &
|
148
|
+
requirement: &2161093340 !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: *2161093340
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: guard-cucumber
|
159
|
-
requirement: &
|
159
|
+
requirement: &2161092740 !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: *2161092740
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: rake
|
170
|
-
requirement: &
|
170
|
+
requirement: &2161092120 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,10 +175,10 @@ dependencies:
|
|
175
175
|
version: '0'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *2161092120
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: bundler
|
181
|
-
requirement: &
|
181
|
+
requirement: &2161091580 !ruby/object:Gem::Requirement
|
182
182
|
none: false
|
183
183
|
requirements:
|
184
184
|
- - ! '>='
|
@@ -186,7 +186,7 @@ dependencies:
|
|
186
186
|
version: '0'
|
187
187
|
type: :development
|
188
188
|
prerelease: false
|
189
|
-
version_requirements: *
|
189
|
+
version_requirements: *2161091580
|
190
190
|
description: ! ' Ruby wrapper that supports all of the GitHub API v3 methods(nearly
|
191
191
|
200). It''s build in a modular way, that is, you can either instantiate the whole
|
192
192
|
api wrapper Github.new or use parts of it e.i. Github::Repos.new if working solely
|
@@ -793,6 +793,8 @@ files:
|
|
793
793
|
- spec/github/request/oauth2_spec.rb
|
794
794
|
- spec/github/request/request_spec.rb
|
795
795
|
- spec/github/request_spec.rb
|
796
|
+
- spec/github/response_wrapper/eql_spec.rb
|
797
|
+
- spec/github/response_wrapper/headers_spec.rb
|
796
798
|
- spec/github/response_wrapper_spec.rb
|
797
799
|
- spec/github/s3_uploader_spec.rb
|
798
800
|
- spec/github/scopes/list_spec.rb
|