lib/barometer/data/geo.rb in attack-barometer-0.1.0 vs lib/barometer/data/geo.rb in attack-barometer-0.2.3
- old
+ new
@@ -6,11 +6,11 @@
# into just the data needed for geocoding
#
class Geo
attr_accessor :latitude, :longitude
- attr_accessor :locality, :region, :country, :country_code
+ attr_accessor :locality, :region, :country, :country_code, :address
#
# this will take a Location object (either generated by Graticule
# or HTTParty), and fill in the applicable data
#
@@ -58,10 +58,11 @@
@longitude = location.longitude
@locality = location.locality
@region = location.region
@country = location.country
@country_code = location.country_code
+ @address = location.address_line
end
def build_from_httparty(location=nil)
return nil unless location
raise ArgumentError unless location.is_a?(Hash)
@@ -85,9 +86,10 @@
end
@region = placemark["AddressDetails"]["Country"]["AdministrativeArea"]["AdministrativeAreaName"]
end
@country = placemark["AddressDetails"]["Country"]["CountryName"]
@country_code = placemark["AddressDetails"]["Country"]["CountryNameCode"]
+ @address = placemark["AddressDetails"]["Country"]["AddressLine"]
end
end
def coordinates
[@latitude, @longitude].join(',')
\ No newline at end of file