Class: VoteSmart::Election
Class Method Summary collapse
-
.get_by_zip(zip5, zip4 = nil, election_year = nil) ⇒ Object
Returns elections in the provided zip code, with optional zip+4 and election_year.
-
.get_election(election_id) ⇒ Object
Returns detailed election information.
-
.get_election_by_year_state(year, state_id) ⇒ Object
returns a list of elections based on the criteria.
-
.get_stage_candidates(election_id, stage_id, party = "") ⇒ Object
Returns a list of candidates in the election and election stage provided.
Methods inherited from Common
construct_url, get_json_data, hash2get, #initialize, parallelize!, request, response_child, session, set_attribute_map, #update_attributes
Constructor Details
This class inherits a constructor from VoteSmart::Common
Class Method Details
.get_by_zip(zip5, zip4 = nil, election_year = nil) ⇒ Object
Returns elections in the provided zip code, with optional zip+4 and election_year
21 22 23 |
# File 'lib/vote_smart/election.rb', line 21 def self.get_by_zip zip5, zip4=nil, election_year=nil request("Election.getElectionByZip", "zip5" => zip5, "zip4" => zip4, "year" => election_year) end |
.get_election(election_id) ⇒ Object
Returns detailed election information
6 7 8 |
# File 'lib/vote_smart/election.rb', line 6 def self.get_election election_id request("Election.getElection", "electionId" => election_id) end |
.get_election_by_year_state(year, state_id) ⇒ Object
returns a list of elections based on the criteria
11 12 13 |
# File 'lib/vote_smart/election.rb', line 11 def self.get_election_by_year_state year, state_id request("Election.getElectionByYearState", "year" => year, "stateId" => state_id) end |
.get_stage_candidates(election_id, stage_id, party = "") ⇒ Object
Returns a list of candidates in the election and election stage provided
16 17 18 |
# File 'lib/vote_smart/election.rb', line 16 def self.get_stage_candidates election_id, stage_id, party = "" request("Election.getStageCandidates", "electionId" => election_id, "stageId" => stage_id, "party" => party) end |