Skip to content
Snippets Groups Projects
Commit f735a8bc authored by toydi's avatar toydi
Browse files

Fix incorrect extra attribute names in ipinfo_io result

parent 54b6484a
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ module Geocoder::Result ...@@ -8,7 +8,7 @@ module Geocoder::Result
end end
def coordinates def coordinates
@data['loc'].split(",").map(&:to_f) @data['loc'].to_s.split(",").map(&:to_f)
end end
def city def city
...@@ -36,7 +36,7 @@ module Geocoder::Result ...@@ -36,7 +36,7 @@ module Geocoder::Result
end end
def self.response_attributes def self.response_attributes
%w['ip', 'region', 'postal'] %w(ip region postal)
end end
response_attributes.each do |a| response_attributes.each do |a|
......
...@@ -22,4 +22,12 @@ class IpinfoIoTest < GeocoderTestCase ...@@ -22,4 +22,12 @@ class IpinfoIoTest < GeocoderTestCase
assert_equal 0.0, result.latitude assert_equal 0.0, result.latitude
assert_equal "127.0.0.1", result.ip assert_equal "127.0.0.1", result.ip
end end
def test_ipinfo_io_extra_attributes
Geocoder.configure(:ip_lookup => :ipinfo_io, :use_https => true)
result = Geocoder.search("8.8.8.8").first
assert_equal "8.8.8.8", result.ip
assert_equal "California", result.region
assert_equal "94040", result.postal
end
end end
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