lib/geocoder/results/yandex.rb in geocoder-1.1.9 vs lib/geocoder/results/yandex.rb in geocoder-1.2.0

- old
+ new

@@ -12,11 +12,11 @@ end def city if state.empty? and address_details.has_key? 'Locality' address_details['Locality']['LocalityName'] - elsif sub_state.empty? + elsif sub_state.empty? and address_details['AdministrativeArea'].has_key? 'Locality' address_details['AdministrativeArea']['Locality']['LocalityName'] elsif not sub_state_city.empty? sub_state_city else "" @@ -57,10 +57,14 @@ 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 private # ---------------------------------------------------------------- @@ -68,11 +72,11 @@ def address_details @data['GeoObject']['metaDataProperty']['GeocoderMetaData']['AddressDetails']['Country'] end def sub_state_city - if sub_state && sub_state["Locality"] - sub_state['Locality']['LocalityName'] + if !sub_state.empty? and address_details['AdministrativeArea']['SubAdministrativeArea'].has_key? 'Locality' + address_details['AdministrativeArea']['SubAdministrativeArea']['Locality']['LocalityName'] || "" else "" end end end