Class: MaxMind::GeoIP2::Record::Traits

Inherits:
Abstract
  • Object
show all
Defined in:
lib/maxmind/geoip2/record/traits.rb

Overview

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

This record is returned by all location services and databases.

Instance Method Summary collapse

Instance Method Details

#anonymous?Boolean

This is true if the IP address belongs to any sort of anonymous network. This property is only available from GeoIP2 Precision Insights.

Returns:

  • (Boolean)


101
102
103
# File 'lib/maxmind/geoip2/record/traits.rb', line 101

def anonymous?
  get('is_anonymous')
end

#anonymous_vpn?Boolean

This is true if the IP address is registered to an anonymous VPN provider. If a VPN provider does not register subnets under names associated with them, we will likely only flag their IP ranges using the hosting_provider? property. This property is only available from GeoIP2 Precision Insights.

Returns:

  • (Boolean)


112
113
114
# File 'lib/maxmind/geoip2/record/traits.rb', line 112

def anonymous_vpn?
  get('is_anonymous_vpn')
end

#autonomous_system_numberInteger?

The autonomous system number associated with the IP address. See Wikipedia. This attribute is only available from the City and Insights web service and the GeoIP2 Enterprise database.

Returns:

  • (Integer, nil)


51
52
53
# File 'lib/maxmind/geoip2/record/traits.rb', line 51

def autonomous_system_number
  get('autonomous_system_number')
end

#autonomous_system_organizationString?

The organization associated with the registered autonomous system number for the IP address. See Wikipedia. This attribute is only available from the City and Insights web service and the GeoIP2 Enterprise database.

Returns:

  • (String, nil)


62
63
64
# File 'lib/maxmind/geoip2/record/traits.rb', line 62

def autonomous_system_organization
  get('autonomous_system_organization')
end

#connection_typeString?

The connection type may take the following values: “Dialup”, “Cable/DSL”, “Corporate”, “Cellular”. Additional values may be added in the future. This attribute is only available in the GeoIP2 Enterprise database.

Returns:

  • (String, nil)


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

def connection_type
  get('connection_type')
end

#domainString?

The second level domain associated with the IP address. This will be something like “example.com” or “example.co.uk”, not “foo.example.com”. This attribute is only available from the City and Insights web service and the GeoIP2 Enterprise database.

Returns:

  • (String, nil)


82
83
84
# File 'lib/maxmind/geoip2/record/traits.rb', line 82

def domain
  get('domain')
end

#hosting_provider?Boolean

This is true if the IP address belongs to a hosting or VPN provider (see description of the anonymous_vpn? property). This property is only available from GeoIP2 Precision Insights.

Returns:

  • (Boolean)


121
122
123
# File 'lib/maxmind/geoip2/record/traits.rb', line 121

def hosting_provider?
  get('is_hosting_provider')
end

#ip_addressString

The IP address that the data in the model is for. If you performed a “me” lookup against the web service, this will be the externally routable IP address for the system the code is running on. If the system is behind a NAT, this may differ from the IP address locally assigned to it. This attribute is returned by all end points.

Returns:

  • (String)


93
94
95
# File 'lib/maxmind/geoip2/record/traits.rb', line 93

def ip_address
  get('ip_address')
end

#ispString?

The name of the ISP associated with the IP address. This attribute is only available from the City and Insights web services and the GeoIP2 Enterprise database.

Returns:

  • (String, nil)


164
165
166
# File 'lib/maxmind/geoip2/record/traits.rb', line 164

def isp
  get('isp')
end

#legitimate_proxy?Boolean

This attribute is true if MaxMind believes this IP address to be a legitimate proxy, such as an internal VPN used by a corporation. This attribute is only available in the GeoIP2 Enterprise database.

Returns:

  • (Boolean)


130
131
132
# File 'lib/maxmind/geoip2/record/traits.rb', line 130

def legitimate_proxy?
  get('is_legitimate_proxy')
end

#networkString

The network in CIDR notation associated with the record. In particular, this is the largest network where all of the fields besides ip_address have the same value.

Returns:

  • (String)


173
174
175
# File 'lib/maxmind/geoip2/record/traits.rb', line 173

def network
  get('network')
end

#organizationString?

The name of the organization associated with the IP address. This attribute is only available from the City and Insights web services and the GeoIP2 Enterprise database.

Returns:

  • (String, nil)


182
183
184
# File 'lib/maxmind/geoip2/record/traits.rb', line 182

def organization
  get('organization')
end

#public_proxy?Boolean

This is true if the IP address belongs to a public proxy. This property is only available from GeoIP2 Precision Insights.

Returns:

  • (Boolean)


138
139
140
# File 'lib/maxmind/geoip2/record/traits.rb', line 138

def public_proxy?
  get('is_public_proxy')
end

#residential_proxy?Boolean

This is true if the IP address is on a suspected anonymizing network and belongs to a residential ISP. This property is only available from GeoIP2 Precision Insights.

Returns:

  • (Boolean)


147
148
149
# File 'lib/maxmind/geoip2/record/traits.rb', line 147

def residential_proxy?
  get('is_residential_proxy')
end

#static_ip_scoreFloat?

An indicator of how static or dynamic an IP address is. This property is only available from GeoIP2 Precision Insights.

Returns:

  • (Float, nil)


190
191
192
# File 'lib/maxmind/geoip2/record/traits.rb', line 190

def static_ip_score
  get('static_ip_score')
end

#tor_exit_node?Boolean

This is true if the IP address is a Tor exit node. This property is only available from GeoIP2 Precision Insights.

Returns:

  • (Boolean)


155
156
157
# File 'lib/maxmind/geoip2/record/traits.rb', line 155

def tor_exit_node?
  get('is_tor_exit_node')
end

#user_countInteger?

The estimated number of users sharing the IP/network during the past 24 hours. For IPv4, the count is for the individual IP. For IPv6, the count is for the /64 network. This property is only available from GeoIP2 Precision Insights.

Returns:

  • (Integer, nil)


200
201
202
# File 'lib/maxmind/geoip2/record/traits.rb', line 200

def user_count
  get('user_count')
end

#user_typeString?

The user type associated with the IP address. This can be one of the following values:

  • business

  • cafe

  • cellular

  • college

  • content_delivery_network

  • dialup

  • government

  • hosting

  • library

  • military

  • residential

  • router

  • school

  • search_engine_spider

  • traveler

This attribute is only available from the Insights web service and the GeoIP2 Enterprise database.

Returns:

  • (String, nil)


227
228
229
# File 'lib/maxmind/geoip2/record/traits.rb', line 227

def user_type
  get('user_type')
end