rOpenGov/rsunlight — pull request #43 by Ironholds (2014-12-20 01:35:01+00:00)
Title: Simplify querying logic

This commit takes the querying logic from each function and moves it into a single function (called, aptly, query). The consequence of this is:

1. os_* functions now check the returned type (they previously didn't);
2. 403s can be handled as a special case rather than simply using stop_for_status, since the source of those problems is obvious enough to let us provide an informative error message that points to the rsunlight documentation;
3. We save ~60 SLOC and only need to tweak one thing if the query structure or results structure changes, rather than tweaking, ah. 32 different things.

As side-effects I've discovered a few bugs and idiosyncracies I'll report; I've also modified the logic in cw_dates to use explicit return() calls and split the if/elses across multiple lines, since it makes the code more readable.