Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Modified content/guides/traversing-with-pagination.md#747

Merged
hubot merged 1 commit intomasterfromupdate-1428355494
Apr 6, 2015
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletionscontent/guides/traversing-with-pagination.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -141,11 +141,10 @@ The loop will finish when there is no `rels[:next]` information to consume (in o
words, we are at `rels[:last]`). It might look something like this:

#!ruby
loop do
putslast_response.data.items.first.path
puts last_response.data.items.first.path
untillast_response.rels[:next].nil?
last_response = last_response.rels[:next].get
sleep 4 # back off from the API rate limiting; don't do this in Real Life
break if last_response.rels[:next].nil?
puts last_response.data.items.first.path
end

Changing the number of items per page is extremely simple with Octokit.rb. Simply
Expand All@@ -170,11 +169,10 @@ your code should remain intact:

puts "And here's the first path for every set"

loop do
putslast_response.data.items.first.path
puts last_response.data.items.first.path
untillast_response.rels[:next].nil?
last_response = last_response.rels[:next].get
sleep 4 # back off from the API rate limiting; don't do this in Real Life
break if last_response.rels[:next].nil?
puts last_response.data.items.first.path
end

## Constructing Pagination Links
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp