Class: Ipregistry::Models::RequesterIpInfo

Inherits:
IpInfo
  • Object
show all
Defined in:
lib/ipregistry/models/ip_info.rb

Overview

IpInfo enriched with parsed User-Agent data. Returned by Client#lookup_origin, where the User-Agent of the calling client is known.

Instance Method Summary collapse

Methods inherited from IpInfo

#ipv4?, #ipv6?

Methods inherited from Base

#==, #[], #hash, #initialize, #inspect, #to_h

Constructor Details

This class inherits a constructor from Ipregistry::Models::Base

Instance Method Details

#user_agentUserAgent?

The parsed User-Agent of the requester, or nil when the API did not return any.

Returns:



102
103
104
105
106
107
108
# File 'lib/ipregistry/models/ip_info.rb', line 102

def user_agent
  value = @data["user_agent"]
  return nil unless value.is_a?(Hash)

  @embedded ||= {}
  @embedded[:user_agent] ||= UserAgent.new(value)
end