Sha256: e7cffd9a59609eebd07e8adf919fdd1f2e2fd443e0f814177b2ceb8af3cd5cbe
Contents?: true
Size: 934 Bytes
Versions: 2
Compression:
Stored size: 934 Bytes
Contents
require 'geocoder2/results/base' module Geocoder2::Result class Esri < Base def address address = reverse_geocode? ? 'Address' : 'Match_addr' attributes[address] end def city attributes['City'] end def state_code attributes['Region'] end alias_method :state, :state_code def country country = reverse_geocode? ? "CountryCode" : "Country" attributes[country] end alias_method :country_code, :country def postal_code attributes['Postal'] end def coordinates [geometry["y"], geometry["x"]] end private def attributes reverse_geocode? ? @data['address'] : @data['locations'].first['feature']['attributes'] end def geometry reverse_geocode? ? @data["location"] : @data['locations'].first['feature']["geometry"] end def reverse_geocode? @data['locations'].nil? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geocoder2-0.1.1 | lib/geocoder2/results/esri.rb |
geocoder2-0.1.0 | lib/geocoder2/results/esri.rb |