Class: Ipregistry::Models::RequesterIpInfo
- 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
-
#user_agent ⇒ UserAgent?
The parsed User-Agent of the requester, or nil when the API did not return any.
Methods inherited from IpInfo
Methods inherited from Base
#==, #[], #hash, #initialize, #inspect, #to_h
Constructor Details
This class inherits a constructor from Ipregistry::Models::Base
Instance Method Details
#user_agent ⇒ UserAgent?
The parsed User-Agent of the requester, or nil when the API did not return any.
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 |