Skip to content
Snippets Groups Projects
Commit a8ddce9b authored by Idris's avatar Idris
Browse files

Added return empty string if city not exist for some region( Yandex provider )

parent 2642ddb2
No related branches found
No related tags found
No related merge requests found
...@@ -16,8 +16,10 @@ module Geocoder::Result ...@@ -16,8 +16,10 @@ module Geocoder::Result
address_details['Locality']['LocalityName'] address_details['Locality']['LocalityName']
elsif sub_state.empty? elsif sub_state.empty?
address_details['AdministrativeArea']['Locality']['LocalityName'] address_details['AdministrativeArea']['Locality']['LocalityName']
else elsif not sub_state_city.empty?
address_details['AdministrativeArea']['SubAdministrativeArea']['Locality']['LocalityName'] sub_state_city
else
""
end end
end end
...@@ -62,5 +64,13 @@ module Geocoder::Result ...@@ -62,5 +64,13 @@ module Geocoder::Result
def address_details def address_details
@data['GeoObject']['metaDataProperty']['GeocoderMetaData']['AddressDetails']['Country'] @data['GeoObject']['metaDataProperty']['GeocoderMetaData']['AddressDetails']['Country']
end end
def sub_state_city
if sub_state && sub_state["Locality"]
sub_state['Locality']['LocalityName']
else
""
end
end
end end
end end
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