class Geocoder::Result::Geoip2

def self.response_attributes

def self.response_attributes
  %w[ip]
end

def address(format = :full)

def address(format = :full)
  s = state.to_s == '' ? '' : ", #{state_code}"
  "#{city}#{s} #{postal_code}, #{country}".sub(/^[ ,]*/, '')
end

def city

def city
  return '' unless @data['city']
  @data['city']['names']['en']
end

def coordinates

def coordinates
  [latitude, longitude]
end

def country

def country
  @data['country']['names']['en']
end

def country_code

def country_code
  @data['country']['iso_code']
end

def latitude

def latitude
  return 0.0 unless @data['location']
  @data['location']['latitude'].to_f
end

def longitude

def longitude
  return 0.0 unless @data['location']
  @data['location']['longitude'].to_f
end

def postal_code

def postal_code
  return '' unless @data['postal']
  @data['postal']['code']
end

def state

def state
  return '' unless @data['subdivisions']
  @data['subdivisions'][0]['names']['en']
end

def state_code

def state_code
  return '' unless @data['subdivisions']
  @data['subdivisions'][0]['iso_code']
end