Skip to content

Commit

Permalink
added getByZip responses
Browse files Browse the repository at this point in the history
  • Loading branch information
dwillis authored and Empact committed Jun 19, 2010
1 parent 5b4b72e commit be5b5b4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/vote_smart/candidate.rb
Expand Up @@ -26,7 +26,10 @@ def self.get_by_election election_id
def self.get_by_district district_id, election_year = nil
request("Candidates.getByDistrict", "districtId" => district_id, "electionYear" => election_year)
end


# Returns candidates in the provided zip code, with optional zip+4 and stage
def self.get_by_zip zip5, election_year=nil, zip4=nil, stage_id=nil
request("Candidates.getByZip", "zip5" => zip5, "electionYear" => election_year, "zip4" => zip4, "stageId" => stage_id)
end
end

end
6 changes: 5 additions & 1 deletion lib/vote_smart/district.rb
Expand Up @@ -33,6 +33,10 @@ def self.find_all_by_office_id_and_state_id office_id, state_id
def self.get_by_office_state office_id, state_id = 'NA', district_name = ''
request("District.getByOfficeState", "officeId" => office_id, "stateId" => state_id, "districtName" => district_name)
end


# Returns districts in the provided zip code, with optional zip+4
def self.get_by_zip zip5, zip4=nil
request("District.getByZip", "zip5" => zip5, "zip4" => zip4)
end
end
end
4 changes: 4 additions & 0 deletions lib/vote_smart/election.rb
Expand Up @@ -17,5 +17,9 @@ def self.get_stage_candidates election_id, stage_id, party = ""
request("Election.getStageCandidates", "electionId" => election_id, "stageId" => stage_id, "party" => party)
end

# Returns elections in the provided zip code, with optional zip+4 and election_year
def self.get_by_zip zip5, zip4=nil, election_year=nil
request("Election.getElectionByZip", "zip5" => zip5, "zip4" => zip4, "year" => election_year)
end
end
end
6 changes: 5 additions & 1 deletion lib/vote_smart/official.rb
Expand Up @@ -126,6 +126,10 @@ def self.get_by_election election_id
def self.get_by_district district_id
request("Officials.getByDistrict", "districtId" => district_id)
end


# Returns incumbents in the provided zip code, with optional zip+4 and stage
def self.get_by_zip zip5, election_year=nil, zip4=nil, stage_id=nil
request("Officials.getByZip", "zip5" => zip5, "electionYear" => election_year, "zip4" => zip4, "stageId" => stage_id)
end
end
end

0 comments on commit be5b5b4

Please sign in to comment.