Skip to content
Snippets Groups Projects
Commit 86b38251 authored by Emil Sågfors's avatar Emil Sågfors
Browse files

Add viewport method for Bing

parent 0350c64f
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,10 @@ module Geocoder::Result
@data['address']
end
def viewport
@data['bbox']
end
def self.response_attributes
%w[bbox name confidence entityType]
end
......
......@@ -21,6 +21,16 @@ class BingTest < GeocoderTestCase
assert_equal "New York", result.city
end
def test_result_viewport
result = Geocoder.search("Madison Square Garden, New York, NY").first
assert_equal [
40.744944289326668,
-74.002353921532631,
40.755675807595253,
-73.983625397086143
], result.viewport
end
def test_no_results
results = Geocoder.search("no results")
assert_equal 0, results.length
......
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