github_api 0.4.1 → 0.4.2
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/README.md +15 -1
- data/features/cassettes/pagination/repos.yml +174 -0
- data/features/cassettes/pagination/repos/commits.yml +181 -0
- data/features/cassettes/pagination/repos/commits/next.yml +175 -0
- data/features/cassettes/pagination/repos/commits/sha.yml +135 -0
- data/features/cassettes/pagination/repos/commits/sha/next.yml +136 -0
- data/features/cassettes/pagination/repos/diff.yml +169 -0
- data/features/cassettes/pagination/repos/diff/next.yml +132 -0
- data/features/cassettes/pagination/repos/next.yml +172 -0
- data/features/cassettes/repos/tags.yml +35 -0
- data/features/pagination.feature +62 -5
- data/features/repos.feature +6 -4
- data/features/step_definitions/common_steps.rb +8 -0
- data/features/step_definitions/github_api_steps.rb +19 -3
- data/lib/github_api/api.rb +2 -2
- data/lib/github_api/constants.rb +10 -0
- data/lib/github_api/page_iterator.rb +28 -9
- data/lib/github_api/page_uri_processor.rb +21 -0
- data/lib/github_api/paged_request.rb +1 -1
- data/lib/github_api/repos/watching.rb +8 -7
- data/lib/github_api/request.rb +2 -2
- data/lib/github_api/result.rb +13 -5
- data/lib/github_api/version.rb +1 -1
- data/spec/github/page_iterator_spec.rb +73 -5
- data/spec/github/repos/watching_spec.rb +2 -2
- data/spec/github/result_spec.rb +31 -7
- metadata +11 -2
@@ -0,0 +1,172 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: https://api.github.com:443/users/wycats/repos?page=2&per_page=45
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
accept-encoding:
|
9
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
10
|
+
response: !ruby/struct:VCR::Response
|
11
|
+
status: !ruby/struct:VCR::ResponseStatus
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
server:
|
16
|
+
- nginx/1.0.4
|
17
|
+
date:
|
18
|
+
- Sat, 21 Jan 2012 18:12:45 GMT
|
19
|
+
content-type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
transfer-encoding:
|
22
|
+
- chunked
|
23
|
+
connection:
|
24
|
+
- keep-alive
|
25
|
+
status:
|
26
|
+
- 200 OK
|
27
|
+
x-ratelimit-limit:
|
28
|
+
- "5000"
|
29
|
+
etag:
|
30
|
+
- "\"df777443e7302dc24a36ad5383451366\""
|
31
|
+
link:
|
32
|
+
- <https://api.github.com/users/wycats/repos?page=3&per_page=45>; rel="next", <https://api.github.com/users/wycats/repos?page=3&per_page=45>; rel="last", <https://api.github.com/users/wycats/repos?page=1&per_page=45>; rel="first", <https://api.github.com/users/wycats/repos?page=1&per_page=45>; rel="prev"
|
33
|
+
x-ratelimit-remaining:
|
34
|
+
- "4997"
|
35
|
+
content-encoding:
|
36
|
+
- gzip
|
37
|
+
body: !binary |
|
38
|
+
H4sIAAAAAAAAA+1da2/jRpb9KwUDi8kATZtPvQaL2d6ZSfYxDoK0Nx9mMTBo
|
39
|
+
iZa4pkiBpOy4B/Pf99wqPkoUxb5lMd8IBEGnQ5bIWzznvm/97z9uskOUPsZF
|
40
|
+
cYyKm5X96WYfFmWUPz7lYbre3azSY5J8ujkci120eQzLm9WNa9sLy3Ete/Fg
|
41
|
+
+6tgvnK9v918ujkeNmHZXuM4lmNbtvfgeit3tnKWdM06ydLo8ZgnWGZXlodi
|
42
|
+
dXe3jcvd8el2ne3v3t7XYVnc7aP8ydpk6+IW/w93FcWuugf//W/t9asL1ydh
|
43
|
+
uj2G2wg/8vPx6R0r7MKiecUyP0afbrBKuybrKWiNTfaWJlm4gaTUMus80l+a
|
44
|
+
BONYrvNguyvfX7kuvfRzlr/crJ7DpMDv7uM8z3L100q0m6hY5/GhjLMUD4zr
|
45
|
+
D3n8ikWbW97Ccr2LcvymrxZT+1TEX3GNH9gBJPSa8qVayeMtfonr18BrRf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JxTQoTQ4zBEKcClfaBv8CkAlP7oLMxXHbo3HZmLfS5DX//f5g42FyoswAA
|
171
|
+
|
172
|
+
http_version: "1.1"
|
@@ -165,3 +165,38 @@
|
|
165
165
|
xsti6tGM4iC6Z7zyFx5dGhXAugUOSdO1V1D1YpWpg1f45z9C6mMuZTkAAA==
|
166
166
|
|
167
167
|
http_version: "1.1"
|
168
|
+
- !ruby/struct:VCR::HTTPInteraction
|
169
|
+
request: !ruby/struct:VCR::Request
|
170
|
+
method: :get
|
171
|
+
uri: https://api.github.com:443/user/repos
|
172
|
+
body:
|
173
|
+
headers:
|
174
|
+
accept-encoding:
|
175
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
176
|
+
response: !ruby/struct:VCR::Response
|
177
|
+
status: !ruby/struct:VCR::ResponseStatus
|
178
|
+
code: 401
|
179
|
+
message: Unauthorized
|
180
|
+
headers:
|
181
|
+
server:
|
182
|
+
- nginx/1.0.4
|
183
|
+
date:
|
184
|
+
- Sat, 21 Jan 2012 17:44:53 GMT
|
185
|
+
content-type:
|
186
|
+
- application/json; charset=utf-8
|
187
|
+
connection:
|
188
|
+
- keep-alive
|
189
|
+
status:
|
190
|
+
- 401 Unauthorized
|
191
|
+
x-ratelimit-limit:
|
192
|
+
- "5000"
|
193
|
+
www-authenticate:
|
194
|
+
- Basic realm="GitHub"
|
195
|
+
etag:
|
196
|
+
- "\"99852aefab6a0988db8f62bf2fb96f49\""
|
197
|
+
x-ratelimit-remaining:
|
198
|
+
- "4999"
|
199
|
+
content-length:
|
200
|
+
- "37"
|
201
|
+
body: "{\"message\":\"Requires authentication\"}"
|
202
|
+
http_version: "1.1"
|
data/features/pagination.feature
CHANGED
@@ -1,10 +1,67 @@
|
|
1
1
|
Feature: Githu API pagination
|
2
2
|
In order to paginate number of received records
|
3
3
|
As a user
|
4
|
-
I want to be able to view them in
|
4
|
+
I want to be able to view them in chunks
|
5
5
|
|
6
|
-
Scenario:
|
6
|
+
Scenario: Passing per_page param
|
7
7
|
Given I have "Github::Repos" instance
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
When I am looking for "repos"
|
9
|
+
And I pass the following request options:
|
10
|
+
| user | per_page |
|
11
|
+
| wycats | 45 |
|
12
|
+
And I make request within a cassette named "pagination/repos"
|
13
|
+
Then the response should be "200"
|
14
|
+
And the response type should be "JSON"
|
15
|
+
And the response should have 45 items
|
16
|
+
|
17
|
+
When I request "next" page within a cassette named "pagination/repos/next"
|
18
|
+
Then the response should be "200"
|
19
|
+
And the response should have 45 items
|
20
|
+
|
21
|
+
Scenario: Returned paginated resources are different
|
22
|
+
Given I have "Github::Repos" instance
|
23
|
+
When I am looking for "repos"
|
24
|
+
And I pass the following request options:
|
25
|
+
| user |
|
26
|
+
| wycats |
|
27
|
+
And I make request within a cassette named "pagination/repos/diff"
|
28
|
+
Then the response should be "200"
|
29
|
+
And the response type should be "JSON"
|
30
|
+
And the response should have 30 items
|
31
|
+
|
32
|
+
When I request "next" page within a cassette named "pagination/repos/diff/next"
|
33
|
+
Then the response should be "200"
|
34
|
+
And the response should have 30 items
|
35
|
+
And the response collection of resources is different for "name" attribute
|
36
|
+
|
37
|
+
Scenario: Calling 'commits' for Github::Repos with per_page param
|
38
|
+
Given I have "Github::Repos" instance
|
39
|
+
When I am looking for "commits" with the following params:
|
40
|
+
| user | repo |
|
41
|
+
| peter-murach | github |
|
42
|
+
And I pass the following request options:
|
43
|
+
| per_page |
|
44
|
+
| 45 |
|
45
|
+
And I make request within a cassette named "pagination/repos/commits"
|
46
|
+
Then the response should be "200"
|
47
|
+
And the response type should be "JSON"
|
48
|
+
And the response should have 45 items
|
49
|
+
|
50
|
+
When I request "next" page within a cassette named "pagination/repos/commits/next"
|
51
|
+
Then the response should be "200"
|
52
|
+
And the response should have 45 items
|
53
|
+
|
54
|
+
Scenario: Calling 'commits' for Github::Repos returns different collections
|
55
|
+
Given I have "Github::Repos" instance
|
56
|
+
When I am looking for "commits" with the following params:
|
57
|
+
| user | repo |
|
58
|
+
| peter-murach | github |
|
59
|
+
And I make request within a cassette named "pagination/repos/commits/sha"
|
60
|
+
Then the response should be "200"
|
61
|
+
And the response should have 30 items
|
62
|
+
|
63
|
+
When I request "next" page within a cassette named "pagination/repos/commits/sha/next"
|
64
|
+
Then the response should be "200"
|
65
|
+
And the response should have 30 items
|
66
|
+
And the response collection of resources is different for "sha" attribute
|
67
|
+
|
data/features/repos.feature
CHANGED
@@ -5,15 +5,16 @@ Feature: Accessing Repos Main API
|
|
5
5
|
|
6
6
|
Scenario: Returning all repository branches
|
7
7
|
Given I have "Github::Repos" instance
|
8
|
-
|
8
|
+
When I am looking for "branches" with the following params:
|
9
9
|
| user | repo |
|
10
10
|
| peter-murach | github |
|
11
11
|
And I make request within a cassette named "repos/branches"
|
12
12
|
Then the response should be "200"
|
13
|
+
And the response type should be "JSON"
|
13
14
|
|
14
15
|
Scenario: Returning all repository tags
|
15
16
|
Given I have "Github::Repos" instance
|
16
|
-
|
17
|
+
When I am looking for "tags" with the following params:
|
17
18
|
| user | repo |
|
18
19
|
| peter-murach | github |
|
19
20
|
And I make request within a cassette named "repos/tags"
|
@@ -21,8 +22,9 @@ Feature: Accessing Repos Main API
|
|
21
22
|
|
22
23
|
Scenario: Returning all repositories for the user
|
23
24
|
Given I have "Github::Repos" instance
|
24
|
-
|
25
|
+
When I am looking for "list_repos"
|
26
|
+
And I pass the following request options:
|
25
27
|
| user |
|
26
28
|
| peter-murach |
|
27
|
-
And I make request
|
29
|
+
And I make request within a cassette named "repos/tags"
|
28
30
|
Then the response should be "200"
|
@@ -9,3 +9,11 @@ end
|
|
9
9
|
Then /^the response should be "([^"]*)"$/ do |expected_response|
|
10
10
|
@response.status.should eql expected_response.to_i
|
11
11
|
end
|
12
|
+
|
13
|
+
Then /^the response type should be "([^"]*)"$/ do |type|
|
14
|
+
@response.content_type.should =~ /application\/#{type.downcase}/
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /^the response should have (\d+) items$/ do |size|
|
18
|
+
@response.size.should eql size.to_i
|
19
|
+
end
|
@@ -18,6 +18,16 @@ When /^I will have access to "([^"]*)" API$/ do |api|
|
|
18
18
|
@response.class.to_s.should match api
|
19
19
|
end
|
20
20
|
|
21
|
+
When /^I am looking for "([^"]*)"$/ do |method|
|
22
|
+
@method = method
|
23
|
+
end
|
24
|
+
|
25
|
+
When /^I pass the following request options:$/ do |table|
|
26
|
+
table.hashes.each do |options|
|
27
|
+
@options = options
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
21
31
|
When /^I am looking for "([^"]*)" with the following params:$/ do |method, table|
|
22
32
|
table.hashes.each do |attributes|
|
23
33
|
@method = method.to_sym
|
@@ -26,9 +36,15 @@ When /^I am looking for "([^"]*)" with the following params:$/ do |method, table
|
|
26
36
|
end
|
27
37
|
|
28
38
|
When /^I make request$/ do
|
29
|
-
@
|
39
|
+
@options ||= {}
|
40
|
+
@attributes ||= {}
|
41
|
+
@response = @instance.send @method, *@attributes.values, @options
|
42
|
+
end
|
43
|
+
|
44
|
+
When /^I request "([^"]*)" page$/ do |link|
|
45
|
+
@next_response = @response.send :"#{link}_page"
|
30
46
|
end
|
31
47
|
|
32
|
-
|
33
|
-
@
|
48
|
+
Then /^the response collection of resources is different for "([^"]*)" attribute$/ do |attr|
|
49
|
+
@next_response.first.send(:"#{attr}").should_not eql @response.first.send(:"#{attr}")
|
34
50
|
end
|
data/lib/github_api/api.rb
CHANGED
@@ -174,8 +174,8 @@ module Github
|
|
174
174
|
end
|
175
175
|
|
176
176
|
def _merge_mime_type(resource, params) # :nodoc:
|
177
|
-
|
178
|
-
|
177
|
+
# params['resource'] = resource
|
178
|
+
# params['mime_type'] = params['mime_type'] || :raw
|
179
179
|
end
|
180
180
|
|
181
181
|
# TODO add to core extensions
|
data/lib/github_api/constants.rb
CHANGED
@@ -11,6 +11,12 @@ module Github
|
|
11
11
|
|
12
12
|
CONTENT_LENGTH = 'content-length'.freeze
|
13
13
|
|
14
|
+
ETAG = 'ETag'.freeze
|
15
|
+
|
16
|
+
SERVER = 'Server'.freeze
|
17
|
+
|
18
|
+
DATE = 'Date'.freeze
|
19
|
+
|
14
20
|
# Link headers
|
15
21
|
HEADER_LINK = "Link".freeze
|
16
22
|
|
@@ -34,5 +40,9 @@ module Github
|
|
34
40
|
|
35
41
|
PARAM_START_PAGE = "start_page".freeze
|
36
42
|
|
43
|
+
# URI parsing
|
44
|
+
QUERY_STR_SEP = '?'.freeze
|
45
|
+
|
46
|
+
|
37
47
|
end # Constants
|
38
48
|
end # Github
|
@@ -1,6 +1,4 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'github_api/utils/url'
|
1
|
+
# encoding: utf-8 require 'github_api/utils/url'
|
4
2
|
|
5
3
|
module Github
|
6
4
|
class PageIterator
|
@@ -8,9 +6,6 @@ module Github
|
|
8
6
|
include Github::Utils::Url
|
9
7
|
include Github::PagedRequest
|
10
8
|
|
11
|
-
# Query string separator
|
12
|
-
QUERY_STR_SEP = '?'.freeze
|
13
|
-
|
14
9
|
# Setup attribute accesor for all the link types
|
15
10
|
ATTRIBUTES = [ META_FIRST, META_NEXT, META_PREV, META_LAST ]
|
16
11
|
|
@@ -29,8 +24,21 @@ module Github
|
|
29
24
|
|
30
25
|
def first
|
31
26
|
return nil unless first_page_uri
|
32
|
-
|
33
|
-
|
27
|
+
|
28
|
+
response = if next_page < 1
|
29
|
+
parsed_query = parse_query(first_page_uri.split(QUERY_STR_SEP).last)
|
30
|
+
params = {}
|
31
|
+
if parsed_query.keys.include?('sha')
|
32
|
+
params['sha'] = 'master'
|
33
|
+
end
|
34
|
+
params['per_page'] = parse_per_page_number(first_page_uri)
|
35
|
+
|
36
|
+
page_request first_page_uri.split(QUERY_STR_SEP).first, params
|
37
|
+
else
|
38
|
+
page_request first_page_uri.split(QUERY_STR_SEP)[0],
|
39
|
+
'per_page' => parse_per_page_number(first_page_uri)
|
40
|
+
end
|
41
|
+
|
34
42
|
update_page_links response.links
|
35
43
|
response
|
36
44
|
end
|
@@ -38,9 +46,20 @@ module Github
|
|
38
46
|
def next
|
39
47
|
return nil unless has_next?
|
40
48
|
|
41
|
-
response =
|
49
|
+
response = if next_page < 1
|
50
|
+
parsed_query = parse_query(next_page_uri.split(QUERY_STR_SEP).last)
|
51
|
+
params = {}
|
52
|
+
if parsed_query.keys.include?('last_sha')
|
53
|
+
params['sha'] = parsed_query['last_sha']
|
54
|
+
end
|
55
|
+
params['per_page'] = parse_per_page_number(next_page_uri)
|
56
|
+
|
57
|
+
page_request next_page_uri.split(QUERY_STR_SEP)[0], params
|
58
|
+
else
|
59
|
+
page_request next_page_uri.split(QUERY_STR_SEP)[0],
|
42
60
|
'page' => next_page,
|
43
61
|
'per_page'=> parse_per_page_number(next_page_uri)
|
62
|
+
end
|
44
63
|
update_page_links response.links
|
45
64
|
response
|
46
65
|
end
|