mobilecommons / google_civic_info

Ruby client for Google Civic Information API
MIT License
1 stars 1 forks source link

Handle divisions w/o office_ids or offices #3

Open walter opened 10 years ago

walter commented 10 years ago

I had a case where a division returned in the response didn't have key/value pair for officeIds or offices in the response and it would break parsing.

By drawing from the division.office_ids and division.offices after they loaded, and thus empty values are treated as an empty array, we fix this brittleness.

Refactored code into smaller methods along the way as well as moving away from a class method.

walter commented 10 years ago

@benstein any thoughts on the refactor?