Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add State.find_all, State.find_counties, and State.find_cities methods

  • Loading branch information...
commit 2ebaf50ea7c711e0538bbddd7490d891d6f724d9 1 parent 6d91de3
@ajb ajb authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/gov_kit/vote_smart.rb
View
17 lib/gov_kit/vote_smart.rb
@@ -5,6 +5,23 @@ class VoteSmartResource < Resource
end
module VoteSmart
+ class State < VoteSmartResource
+ def self.find_all
+ response = get("/State.getStateIDs")
+ parse(response['stateList']['list']['state'])
+ end
+
+ def self.find_counties(stateId)
+ response = get("/Local.getCounties", :query => {"stateId" => stateId})
+ parse(response['counties']['county'])
+ end
+
+ def self.find_cities(stateId)
+ response = get("/Local.getCities", :query => {"stateId" => stateId})
+ parse(response['cities']['city'])
+ end
+ end
+
class Address < VoteSmartResource
def self.find(candidate_id)
response = get("/Address.getOffice", :query => {"candidateId" => candidate_id})
Please sign in to comment.
Something went wrong with that request. Please try again.