Class: MaxMind::GeoIP2::Record::Country

Inherits:
Place
  • Object
show all
Defined in:
lib/maxmind/geoip2/record/country.rb

Overview

Contains data for the country record associated with an IP address.

This record is returned by all location services and databases.

See Place for inherited methods.

Direct Known Subclasses

RepresentedCountry

Instance Method Summary collapse

Methods inherited from Place

#name

Instance Method Details

#confidenceInteger?

A value from 0-100 indicating MaxMind’s confidence that the country is correct. This attribute is only available from the Insights service and the GeoIP2 Enterprise database.

Returns:

  • (Integer, nil)


39
40
41
# File 'lib/maxmind/geoip2/record/country.rb', line 39

def confidence
  get('confidence')
end

#geoname_idInteger?

The GeoName ID for the country. This attribute is returned by all location services and databases.

Returns:

  • (Integer, nil)


47
48
49
# File 'lib/maxmind/geoip2/record/country.rb', line 47

def geoname_id
  get('geoname_id')
end

#in_european_union?Boolean

This is true if the country is a member state of the European Union. This attribute is returned by all location services and databases.

Returns:

  • (Boolean)


55
56
57
# File 'lib/maxmind/geoip2/record/country.rb', line 55

def in_european_union?
  get('is_in_european_union')
end

#iso_codeString?

The two-character ISO 3166-1 alpha code for the country. See en.wikipedia.org/wiki/ISO_3166-1. This attribute is returned by all location services and databases.

Returns:

  • (String, nil)


64
65
66
# File 'lib/maxmind/geoip2/record/country.rb', line 64

def iso_code
  get('iso_code')
end

#namesHash<String, String>?

A Hash where the keys are locale codes and the values are names. This attribute is returned by all location services and databases.

Returns:

  • (Hash<String, String>, nil)


72
73
74
# File 'lib/maxmind/geoip2/record/country.rb', line 72

def names
  get('names')
end