From d5dcaf58bdf629e2d4459ffba41c2f982e39a947 Mon Sep 17 00:00:00 2001 From: Steve Hoeksema <steve@seven.net.nz> Date: Tue, 13 Sep 2011 14:22:03 +1200 Subject: [PATCH] Add Google precision attribute to result object --- lib/geocoder/results/google.rb | 4 ++++ test/services_test.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lib/geocoder/results/google.rb b/lib/geocoder/results/google.rb index cb45785f..73e2289d 100644 --- a/lib/geocoder/results/google.rb +++ b/lib/geocoder/results/google.rb @@ -82,5 +82,9 @@ module Geocoder::Result def geometry @data['geometry'] end + + def precision + geometry['location_type'] if geometry + end end end diff --git a/test/services_test.rb b/test/services_test.rb index 5eb7555c..d6ddc852 100644 --- a/test/services_test.rb +++ b/test/services_test.rb @@ -26,6 +26,12 @@ class ServicesTest < Test::Unit::TestCase assert_equal nil, result.city end + def test_google_precision + result = Geocoder.search("Madison Square Garden, New York, NY").first + assert_equal "ROOFTOP", + result.precision + end + # --- Yahoo --- -- GitLab