by steveklabnik · 13y ago · 0 comments
Yes, you can write clients for GitHub's API that works that way, for example.
Here, I whipped you up one: https://gist.github.com/steveklabnik/5282209/e48b100d95ff77f...
This client will return you information about the first gist on the second page of the public list. It does this by fetching the list of gists from the root, then using the pagination to walk forward. GitHub can change all of this, and it'll still work.
$ ruby fetch_gists.rb
DATA:
ID: 5282131
URL: https://api.github.com/gists/5282131
USER: sparksp
Bonus: here's a slightly refactored version. The logic is more clear when you move things into helpers. https://gist.github.com/steveklabnik/5282209/52ed62366586838...I would suggest a better goal to be "get the 11th public gist". Although that still isn't perfect since it doesn't mention how the collection would be sorted (I presume by date).