class Geocoder::Result::Esri
def address
def address address_key = reverse_geocode? ? 'Address' : 'Match_addr' attributes[address_key] end
def attributes
def attributes reverse_geocode? ? @data['address'] : @data['locations'].first['feature']['attributes'] end
def city
def city if !reverse_geocode? && is_city? place_name else attributes['City'] end end
def coordinates
def coordinates [geometry["y"], geometry["x"]] end
def country
def country country_key = reverse_geocode? ? "CountryCode" : "Country" attributes[country_key] end
def geometry
def geometry reverse_geocode? ? @data["location"] : @data['locations'].first['feature']["geometry"] end
def is_city?
def is_city? ['City', 'State Capital', 'National Capital'].include?(place_type) end
def place_name
def place_name place_name_key = reverse_geocode? ? "Address" : "PlaceName" attributes[place_name_key] end
def place_type
def place_type reverse_geocode? ? "Address" : attributes['Type'] end
def postal_code
def postal_code attributes['Postal'] end
def reverse_geocode?
def reverse_geocode? @data['locations'].nil? end
def state
def state attributes['Region'] end
def state_code
def state_code abbr = attributes['RegionAbbr'] abbr.to_s == "" ? state : abbr end
def viewport
def viewport north = attributes['Ymax'] south = attributes['Ymin'] east = attributes['Xmax'] west = attributes['Xmin'] [south, west, north, east] end