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 data.fetch('city', {}).fetch('names', {}).fetch(locale, '') end
def coordinates
def coordinates %w[latitude longitude].map do |l| data.fetch('location', {}).fetch(l, 0.0) end end
def country
def country data.fetch('country', {}).fetch('names', {}).fetch(locale, '') end
def country_code
def country_code data.fetch('country', {}).fetch('iso_code', '') end
def data
def data @data.to_hash end
def locale
def locale @locale ||= Geocoder.config[:language].to_s end
def postal_code
def postal_code data.fetch('postal', {}).fetch('code', '') end
def state
def state data.fetch('subdivisions', []).fetch(0, {}).fetch('names', {}).fetch(locale, '') end
def state_code
def state_code data.fetch('subdivisions', []).fetch(0, {}).fetch('iso_code', '') end