lib/vote_smart/official.rb in votesmart-0.3.3 vs lib/vote_smart/official.rb in votesmart-0.4.0

- old
+ new

@@ -46,19 +46,23 @@ 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 + require 'ym4r/google_maps/geocoding' + + placemark = Ym4r::GoogleMaps::Geocoding.get("#{address} #{city}, #{state} #{zip}").first return [] unless placemark state ||= placemark.administrative_area placemark ? find_all_by_state_and_latitude_and_longitude(state, placemark.latitude, placemark.longitude) : [] end def self.find_all_by_state_and_latitude_and_longitude state, latitude, longitude + require "#{File.dirname(__FILE__)}/../mcll4r/mcll4r" + response = Mcll4r.new.district_lookup(latitude, longitude) response = response["response"] if response state_upper = (response["state_upper"] || {})["district"] state_lower = (response["state_lower"] || {})["district"]