class Geocoder::Result::Here

def address(format = :full)


A string in the given format.
#
def address(format = :full)
  address_data["label"]
end

def address_data

def address_data
  @data["address"] || fail
end

def city

def city
  address_data["city"]
end

def coordinates


A two-element array: [lat, lon].
#
def coordinates
  fail unless d = @data["position"]
  [d["lat"].to_f, d["lng"].to_f]
end

def country

def country
  address_data["countryName"]
end

def country_code

def country_code
  address_data["countryCode"]
end

def postal_code

def postal_code
  address_data["postalCode"]
end

def province

def province
  address_data["county"]
end

def province_code

def province_code
  address_data["state"]
end

def route

def route
  address_data["street"]
end

def state

def state
  address_data["state"]
end

def state_code

def state_code
  address_data["stateCode"]
end

def street_number

def street_number
  address_data["houseNumber"]
end  

def viewport

def viewport
  return [] if data["resultType"] == "place"
  map_view = data["mapView"]
  south = map_view["south"]
  west = map_view["west"]
  north = map_view["north"]
  east = map_view["east"]
  [south, west, north, east]
end