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

Add viewport method for Yahoo

parent dd65ed7a
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,11 @@ module Geocoder::Result
@data['hash']
end
def viewport
boundingbox = @data['boundingbox'] || fail
%w(south west north east).map{ |i| boundingbox[i].to_f }
end
def self.response_attributes
%w[quality offsetlat offsetlon radius boundingbox name
line1 line2 line3 line4 cross house street xstreet unittype unit
......
......@@ -24,6 +24,12 @@ class YahooTest < GeocoderTestCase
assert_equal "Madison Square Garden, New York, NY 10001, United States", result.address
end
def test_result_viewport
result = Geocoder.search("Madison Square Garden, New York, NY").first
assert_equal [40.749931, -73.994591, 40.750832, -73.993393],
result.viewport
end
def test_raises_exception_when_over_query_limit
Geocoder.configure(:always_raise => [Geocoder::OverQueryLimitError])
l = Geocoder::Lookup.get(:yahoo)
......
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