From 06a4bd6ce352661fdd8da2dd08836cbae821d4cf Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 15 Aug 2013 22:55:06 +0200 Subject: [PATCH] Moved to response.kind_of? Net::HTTPSuccess for response. --- lib/geo_location/gmaps.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/geo_location/gmaps.rb b/lib/geo_location/gmaps.rb index 6b619c634..5a703003d 100644 --- a/lib/geo_location/gmaps.rb +++ b/lib/geo_location/gmaps.rb @@ -3,7 +3,7 @@ class GeoLocation::Gmaps def self.geocode(address) url = "http://maps.googleapis.com/maps/api/geocode/json?address=#{CGI::escape address}&sensor=true" response = Net::HTTP.get_response( URI.parse(url) ) - return if response.code.to_s != '200' + return if ! response.kind_of? Net::HTTPSuccess result = JSON.parse( response.body ) @@ -15,7 +15,7 @@ class GeoLocation::Gmaps def self.reverse_geocode(lat,lng) url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=#{lat},#{lng}&sensor=true" response = Net::HTTP.get_response( URI.parse(url) ) - return if response.code.to_s != '200' + return if ! response.kind_of? Net::HTTPSuccess result = JSON.parse( response.body )