Class: VoteSmart::Candidate
- Defined in:
- lib/vote_smart/candidate.rb
Class Method Summary collapse
-
.get_by_district(district_id, election_year = nil) ⇒ Object
Returns candidates in the provided district_id.
-
.get_by_election(election_id) ⇒ Object
Returns candidates in the provided election_id.
-
.get_by_lastname(last_name, election_year = nil) ⇒ Object
Searches for candidates with exact lastname matches.
-
.get_by_levenstein(last_name, election_year = nil) ⇒ Object
Searches for candidates with fuzzy lastname match.
-
.get_by_office_state(office_id, state_id = "NA", election_year = nil) ⇒ Object
Returns a list of candidates/incumbents that fit the criteria.
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_by_district(district_id, election_year = nil) ⇒ Object
Returns candidates in the provided district_id
26 27 28 |
# File 'lib/vote_smart/candidate.rb', line 26 def self.get_by_district district_id, election_year = nil request("Candidates.getByDistrict", "districtId" => district_id, "electionYear" => election_year) end |
.get_by_election(election_id) ⇒ Object
Returns candidates in the provided election_id
21 22 23 |
# File 'lib/vote_smart/candidate.rb', line 21 def self.get_by_election election_id request("Candidates.getByElection", "electionId" => election_id) end |
.get_by_lastname(last_name, election_year = nil) ⇒ Object
Searches for candidates with exact lastname matches
11 12 13 |
# File 'lib/vote_smart/candidate.rb', line 11 def self.get_by_lastname last_name, election_year = nil request("Candidates.getByLastname", "lastName" => last_name, "electionYear" => election_year) end |
.get_by_levenstein(last_name, election_year = nil) ⇒ Object
Searches for candidates with fuzzy lastname match
16 17 18 |
# File 'lib/vote_smart/candidate.rb', line 16 def self.get_by_levenstein last_name, election_year = nil request("Candidates.getByLevenstein", "lastName" => last_name, "electionYear" => election_year) end |
.get_by_office_state(office_id, state_id = "NA", election_year = nil) ⇒ Object
Returns a list of candidates/incumbents that fit the criteria
6 7 8 |
# File 'lib/vote_smart/candidate.rb', line 6 def self.get_by_office_state office_id, state_id = "NA", election_year = nil request("Candidates.getByOfficeState", "officeId" => office_id, "stateId" => state_id, "electionYear" => election_year) end |