Class: MaxMind::GeoIP2::Record::Subdivision

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

Overview

Contains data for the subdivisions associated with an IP address.

This record is returned by all location databases and services besides Country.

See Place for inherited methods.

Instance Method Summary collapse

Methods inherited from Place

#name

Instance Method Details

#confidenceInteger?

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

Returns:

  • (Integer, nil)


20
21
22
# File 'lib/maxmind/geoip2/record/subdivision.rb', line 20

def confidence
  get('confidence')
end

#geoname_idInteger?

This is a GeoName ID for the subdivision. This attribute is returned by all location databases and services besides Country.

Returns:

  • (Integer, nil)


28
29
30
# File 'lib/maxmind/geoip2/record/subdivision.rb', line 28

def geoname_id
  get('geoname_id')
end

#iso_codeString?

This is a string up to three characters long contain the subdivision portion of the ISO 3166-2 code. See en.wikipedia.org/wiki/ISO_3166-2. This attribute is returned by all location databases and services except Country.

Returns:

  • (String, nil)


38
39
40
# File 'lib/maxmind/geoip2/record/subdivision.rb', line 38

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 besides country.

Returns:

  • (Hash<String, String>, nil)


46
47
48
# File 'lib/maxmind/geoip2/record/subdivision.rb', line 46

def names
  get('names')
end