Skip to content
Snippets Groups Projects
Commit 6adfe5a6 authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #681 from pbrumm/bug/geocodio_formatting

json coming from geocodio has changed from floats to strings
parents c06d2c12 239da9b5
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,7 @@ module Geocoder::Result ...@@ -45,7 +45,7 @@ module Geocoder::Result
end end
def coordinates def coordinates
['lat', 'lng'].map{ |i| location[i] } if location ['lat', 'lng'].map{ |i| location[i].to_f } if location
end end
def accuracy 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}]} {"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 \ No newline at end of file
...@@ -19,7 +19,7 @@ class GeocodioTest < GeocoderTestCase ...@@ -19,7 +19,7 @@ class GeocodioTest < GeocoderTestCase
assert_equal "NW", result.postdirectional assert_equal "NW", result.postdirectional
assert_equal "Washington", result.city assert_equal "Washington", result.city
assert_equal "1101 Pennsylvania Ave NW, Washington DC, 20004", result.formatted_address 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 end
def test_no_results 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