lib/vote_smart/official.rb in votesmart-0.3.0 vs lib/vote_smart/official.rb in votesmart-0.3.1
- old
+ new
@@ -45,12 +45,10 @@
official.office_id = office_id if official
official.state_id ||= state_id if official
official
end
-
-
def self.find_all_by_address address, city, state, zip
placemark = Geocoding.get("#{address} #{city}, #{state} #{zip}").first
return [] unless placemark
@@ -99,10 +97,13 @@
end
officials
end
+ def self.get_statewide(state_id = 'NA')
+ request("Officials.getStatewide", "stateId" => state_id)
+ end
# Returns a list of incumbents that fit the criteria
def self.get_by_office_state office_id, state_id = 'NA'
request("Officials.getByOfficeState", "officeId" => office_id, "stateId" => state_id)
end
@@ -124,8 +125,12 @@
# Returns incumbents in the provided district_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