Class: VoteSmart::Election

Inherits:
Common
  • Object
show all
Defined in:
lib/vote_smart/election.rb

Class Method Summary collapse

Methods inherited from Common

construct_url, get_json_data, hash2get, #initialize, request, response_child, response_child_array, set_attribute_map, #update_attributes

Constructor Details

This class inherits a constructor from VoteSmart::Common

Class Method Details

.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