Sha256: f189b3b40f03d61cc92d051703b290f6c93c2ee73c96d7b2f3394807d59cf344

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

module VoteSmart
  
  class Candidate < Common
    
    # Returns a list of candidates/incumbents that fit the criteria
    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
    
    #Searches for candidates with exact lastname matches
    def self.get_by_lastname last_name, election_year = nil
      request("Candidates.getByLastname", "lastName" => last_name, "electionYear" => election_year)
    end
    
    # Searches for candidates with fuzzy lastname match
    def self.get_by_levenstein last_name, election_year = nil
      request("Candidates.getByLevenstein", "lastName" => last_name, "electionYear" => election_year)
    end
    
    # Returns candidates in the provided election_id
    def self.get_by_election election_id
      request("Candidates.getByElection", "electionId" => election_id)
    end
    
    # Returns candidates in the provided district_id
    def self.get_by_district district_id, election_year = nil
      request("Candidates.getByDistrict", "districtId" => district_id, "electionYear" => election_year)
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
netroots-ruby-votesmart-0.2.0 lib/vote_smart/candidate.rb
netroots-ruby-votesmart-0.2.1 lib/vote_smart/candidate.rb
netroots-ruby-votesmart-0.2.2 lib/vote_smart/candidate.rb
netroots-ruby-votesmart-0.2.3 lib/vote_smart/candidate.rb
netroots-ruby-votesmart-0.2.4 lib/vote_smart/candidate.rb
votesmart-0.3.0 lib/vote_smart/candidate.rb