class Geocoder::Result::Nominatim

def self.response_attributes

def self.response_attributes
  %w[place_id osm_type osm_id boundingbox license
     polygonpoints display_name class type stadium]
end

def address

def address
  @data['display_name']
end

def address_data

def address_data
  @data['address'] || {}
end

def city

def city
  %w[city town village hamlet].each do |key|
    return address_data[key] if address_data.key?(key)
  end
  return nil
end

def city_district

def city_district
  address_data['city_district']
end

def coordinates

def coordinates
  return [] unless @data['lat'] && @data['lon']
  [@data['lat'].to_f, @data['lon'].to_f]
end

def country

def country
  address_data['country']
end

def country_code

def country_code
  address_data['country_code']
end

def county

def county
  address_data['county']
end

def house_number

def house_number
  address_data['house_number']
end

def municipality

def municipality
  address_data['municipality']
end

def neighbourhood

def neighbourhood
  address_data['neighbourhood']
end

def place_class

def place_class
  @data['class']
end

def place_type

def place_type
  @data['type']
end

def poi

def poi
  return address_data[place_type] if address_data.key?(place_type)
  return nil
end

def postal_code

def postal_code
  address_data['postcode']
end

def state

def state
  address_data['state']
end

def state_district

def state_district
  address_data['state_district']
end

def street

def street
  %w[road pedestrian highway].each do |key|
    return address_data[key] if address_data.key?(key)
  end
  return nil
end

def suburb

def suburb
  address_data['suburb']
end

def town

def town
  address_data['town']
end

def viewport

def viewport
  south, north, west, east = @data['boundingbox'].map(&:to_f)
  [south, west, north, east]
end

def village

def village
  address_data['village']
end