Installeer de gems GeoKit en Twitter, via "gem install geokit" (zonder de aanhalingstekens) en twitter. Alle dependencies worden automatisch geïnstalleerd.
require "rubygems"
require "twitter"
require 'geokit'
include Geokit::Geocoders
username = "dutchalbatros"
friends_list = Twitter.friends(username)
friends_list.users.each do |friend|
puts "----------------------------"
unless friend.location.nil? || friend.location.strip.empty?
puts "#{friend.name} AKA #{friend.screen_name} is from #{friend.location}"
geo = Geokit::Geocoders::YahooGeocoder.geocode(friend.location)
puts geo.success ? "#{geo.lat}, #{geo.lng}" : "Unable to find Geo for #{friend.location}"
######################################################################
res=GoogleGeocoder.reverse_geocode([geo.lat, geo.lng])
puts "Het voledige adres is: #{res.full_address}"
######################################################################
else
puts "#{friend.name} AKA #{friend.screen_name} idk where they are from..."
puts "No listed location"
end
end