Skip to content

Commit

Permalink
Merge pull request alexreisner#586 from twonegatives/master
Browse files Browse the repository at this point in the history
add object kind recognising for yandex result object
  • Loading branch information
alexreisner committed Jan 27, 2014
2 parents fecc20d + 23ec46e commit 0c1573e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/geocoder/results/yandex.rb
Expand Up @@ -59,6 +59,10 @@ def premise_name
address_details['Locality']['Premise']['PremiseName']
end

def kind
@data['GeoObject']['metaDataProperty']['GeocoderMetaData']['kind']
end

def precision
@data['GeoObject']['metaDataProperty']['GeocoderMetaData']['precision']
end
Expand Down
10 changes: 10 additions & 0 deletions test/result_test.rb
Expand Up @@ -30,6 +30,16 @@ def test_yandex_result_new_york
end
end

def test_yandex_result_kind
assert_nothing_raised do
Geocoder.configure(:lookup => :yandex)
set_api_key!(:yandex)
["new york", [45.423733, -75.676333], "no city and town"].each do |query|
Geocoder.search("new york").first.kind
end
end
end

private # ------------------------------------------------------------------

def assert_result_has_required_attributes(result)
Expand Down

0 comments on commit 0c1573e

Please sign in to comment.