pengwynn/octokit — pull request #142 by bratsche (2012-10-04 05:08:06+00:00)
Title: Conditional Requests

Hi, I just took a look at octokit tonight and I really like it. I don't see an obvious way to deal with Github's conditional requests, so I'm making a stab at implementing this myself. Let me know if you have some suggestions for how you'd rather this work.

I added a section to the README for how this works. I tried to implement this so that it has no big changes to the style of the API.

Basically, any API request has an `options` hash parameter, and I made it so that passing `:since` or `:etag` will apply its value to the `If-Modified-Since` or `If-None-Match` request headers, respectively.

Then once the request is finished, and since it's a synchronous request, then the client will have two attributes, `last_modified` and `etag`, which may be read for the next time this request is made.