tyrauber / census_api

A Ruby Gem for querying the US Census Bureau API
MIT License
30 stars 9 forks source link

Replace positional arguments with hash arguments #15

Closed beechnut closed 10 years ago

beechnut commented 10 years ago

Users new to the Census or the Census API may be initially confused about the code they read that invokes the census_api gem. It may be a good idea to convert positional arguments into hash arguments, so that future code readers understand why there are two or more geography words in the request, and what the obscure field codes mean.

In sum,

@client.find(fields: 'P0010001,P0020001', of: 'COUNTY:001', within: 'STATE:25')

is clearer than

@client.find('P0010001,P0020001', 'COUNTY:001', 'STATE:25')
tyrauber commented 10 years ago

Agreed. Although, I am sensitive to changing the api on people who may be using the gem in production. I opted to create a new method client#where and deprecate client#find. See:

SHA: 9cf2ad2c180a2ccd807e6aa59349910758a1ee0a

The documentation and specs have been updated to reflect the changes.

Version bump to 1.0.7.