Skip to content

Commit

Permalink
Added the Google Maps module to the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio Javier Cicchelli committed Nov 2, 2009
1 parent 02a773e commit 1ae5aa6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/rubyists/google_maps.rb
@@ -0,0 +1,15 @@
require 'open-uri'
require 'json'

module GoogleMaps
def self.valid_location?(city, country)
result = true

open("http://maps.google.com/maps/geo?q=#{city.gsub(' ', '+')},+#{country.gsub(' ', '+')}") do |file|
response = JSON.parse(file.read)
result = false if response['Status']['code'] == 602
end

result
end
end

0 comments on commit 1ae5aa6

Please sign in to comment.