Method: Wmap::GeoIPTracker#country

Defined in:
lib/wmap/geoip_tracker.rb

#country(object) ⇒ Object

Wrapper for the Ruby GeoIP Country class - return data structure below on successful lookup Struct.new(:request, :ip, :country_code, :country_code2, :country_code3, :country_name, :continent_code)



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/wmap/geoip_tracker.rb', line 47

def country(object)	
	puts "Perform GeoIP country lookup on: #{object}" if @verbose
	begin
		object=object.strip
		raise "Unknown object format - only valid hostname or IP is accepted: #{object}" unless is_ip?(object) or is_fqdn?(object)
		GeoIP.new(Db_country).country(object)
	rescue Exception => ee
		puts "Exception on method country: #{object}" if @verbose
		return nil
	end
end