diff --git a/lib/geocoder/results/yandex.rb b/lib/geocoder/results/yandex.rb index ca2b3f20abf900d6e4607102fe5dbc4c6342f0b2..32d093aadc9ba179a6e24d7339dd5f80fee93766 100644 --- a/lib/geocoder/results/yandex.rb +++ b/lib/geocoder/results/yandex.rb @@ -12,7 +12,11 @@ module Geocoder::Result end def city - address_details['Locality']['LocalityName'] + if state.empty? + address_details['Locality']['LocalityName'] + else + address_details['AdministrativeArea']['Locality']['LocalityName'] + end end def country @@ -24,7 +28,11 @@ module Geocoder::Result end def state - "" + if address_details['AdministrativeArea'] + address_details['AdministrativeArea']['AdministrativeAreaName'] + else + "" + end end def state_code