Adding new Vote Smart methods (Issue #29) #30

Merged
merged 4 commits into from Jul 21, 2012

Projects

None yet

2 participants

@ajb
Contributor
ajb commented Jun 23, 2012

Adding a few methods that I find useful to the Vote Smart library. No tests written, since there don't seem to be any for Vote Smart in the first place.

@NateBarnes
Contributor

Looks good to me, I vote merge.

@ajb
Contributor
ajb commented Jun 29, 2012

Thanks for the vote of confidence (no pun intended...) -- although the more I'm using the VS API, the more I realize that there needs to be a more robust wrapper in place to deal with VS's inconsistencies.

Vote Smart doesn't know the difference between an object and an array of objects, which makes us need this code in order to process both http://api.votesmart.org/Local.getCities?key=XXX&stateId=HI&o=JSON and http://api.votesmart.org/Local.getCities?key=XXX&stateId=CA&o=JSON

    if response['cities']['city'].instance_of?(Array)
      parse(response['cities']['city'])
    else
      [ parse(response['cities']['city']) ]         
    end

I'm in contact with VoteSmart's "IT" department, and I'll let you guys know if I hear anything useful.

@NateBarnes NateBarnes merged commit 15e3072 into opengovernment:master Jul 21, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment