fcoury / octopi

A Ruby interface to GitHub API v2
http://hasmany.info/2009/4/18/ruby-interface-to-github-api
MIT License
216 stars 47 forks source link

Commit Example #21

Closed runpaint closed 15 years ago

runpaint commented 15 years ago

examples/overall.rb contains:

# commits of a[sic] the repository
first_commit = repo.commits.first
puts "First commit: #{first_commit.id} - #{first_commit.message} - by #{first_commit.author['name']}"

first_commit is actually the most recent, i.e. last commit. The API doesn't necessarily return the first commit at all due to pagination being unimplemented. I'm opening this ticket because I don't know what we should do here.

We could change the example to refer to the last commit, but then this creates misleading syntax - .first refers to the last.

We could reverse the array before receiving returning it to the caller, but this will surely prove expensive in the case of paginated responses.

The first option is the simplest, but I'm wondering whether there are any better ideas?

fcoury commented 15 years ago

We could make the name position agnostic, like sample_commit or even just commit for exemplification only. Let me know what you think.

runpaint commented 15 years ago

Yeah, I guess that's the best we can do. ;-/

fcoury commented 15 years ago

It's done: just commit for now ;)