class Geocoder::Result::Ipstack

def self.response_attributes

def self.response_attributes
  [
    ['ip', ''],
    ['hostname', ''],
    ['continent_code', ''],
    ['continent_name', ''],
    ['country_code', ''],
    ['country_name', ''],
    ['region_code', ''],
    ['region_name', ''],
    ['city', ''],
    ['zip', ''],
    ['latitude', 0],
    ['longitude', 0],
    ['location', {}],
    ['time_zone', {}],
    ['currency', {}],
    ['connection', {}],
    ['security', {}],
  ]
end

def address(format = :full)

def address(format = :full)
  s = region_code.empty? ? "" : ", #{region_code}"
  "#{city}#{s} #{zip}, #{country_name}".sub(/^[ ,]*/, "")
end

def country

def country
  @data['country_name']
end

def metro_code

def metro_code
  Geocoder.log(:warn, "Ipstack does not implement `metro_code` in api results.  Please discontinue use.")
  0 # no longer implemented by ipstack
end

def postal_code

def postal_code
  @data['zip'] || @data['zipcode'] || @data['zip_code']
end

def state

def state
  @data['region_name']
end

def state_code

def state_code
  @data['region_code']
end