Skip to content
Snippets Groups Projects
Commit 239da9b5 authored by Pete Brumm's avatar Pete Brumm
Browse files

json coming from geocodio now has strings instead of floats. this fixes it

parent c06d2c12
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ module Geocoder::Result
end
def coordinates
['lat', 'lng'].map{ |i| location[i] } if location
['lat', 'lng'].map{ |i| location[i].to_f } if location
end
def accuracy
......
{"input":{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC"},"results":[{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC","zip":"20004"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC, 20004","location":{"lat":38.895019,"lng":-77.028095},"accuracy":1},{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC","zip":"20004"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC, 20004","location":{"lat":38.895016122449,"lng":-77.028084377551},"accuracy":0.8}]}
\ No newline at end of file
{"input":{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC"},"results":[{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC","zip":"20004"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC, 20004","location":{"lat":"38.895019","lng":"-77.028095"},"accuracy":1},{"address_components":{"number":"1101","street":"Pennsylvania","suffix":"Ave","postdirectional":"NW","city":"Washington","state":"DC","zip":"20004"},"formatted_address":"1101 Pennsylvania Ave NW, Washington DC, 20004","location":{"lat":"38.895016122449","lng":"-77.028084377551"},"accuracy":0.8}]}
\ No newline at end of file
......@@ -19,7 +19,7 @@ class GeocodioTest < GeocoderTestCase
assert_equal "NW", result.postdirectional
assert_equal "Washington", result.city
assert_equal "1101 Pennsylvania Ave NW, Washington DC, 20004", result.formatted_address
assert_equal({ "lat" => 38.895019, "lng" => -77.028095 }, result.location)
assert_equal({ "lat" => "38.895019", "lng" => "-77.028095" }, result.location)
end
def test_no_results
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment