class Geocoder::Result::GeoportailLu

def address

def address
  full_address
end

def city

def city
  try_to_extract 'locality', detailled_address
end

def coordinates

def coordinates
  geomlonlat['coordinates'].reverse if geolocalized?
end

def detailled_address

def detailled_address
  data['AddressDetails']
end

def full_address

def full_address
  data['address']
end

def geolocalized?

def geolocalized?
  try_to_extract('coordinates', geomlonlat).present?
end

def geomlonlat

def geomlonlat
  data['geomlonlat']
end

def postal_code

def postal_code
  try_to_extract 'zip', detailled_address
end

def state

def state
  'Luxembourg'
end

def state_code

def state_code
  'LU'
end

def street

def street
  try_to_extract 'street', detailled_address
end

def street_address

def street_address
  [street_number, street].compact.join(' ')
end

def street_number

def street_number
  try_to_extract 'postnumber', detailled_address
end

def try_to_extract(key, nullable_hash)

def try_to_extract(key, nullable_hash)
  nullable_hash.try(:[], key)
end