Sha256: 4e3f8f88c2ff5042ba7393ea8d33959af2f1a8c44ab225e468f7fef6e01e295f
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
# frozen_string_literal: true require 'maxmind/geoip2/model/insights' require 'minfraud/model/geoip2_location' require 'minfraud/model/ip_risk_reason' module Minfraud module Model # Model containing GeoIP2 data and the risk for the IP address. class IPAddress < MaxMind::GeoIP2::Model::Insights # This field contains the risk associated with the IP address. The value # ranges from 0.01 to 99. A higher score indicates a higher risk. # # @return [Float] attr_reader :risk # This field contains IPRiskReason objects identifying the reasons why # the IP address received the associated risk. This will be an empty # array if there are no reasons. # # @return [Array<Minfraud::Model::IPRiskReason>] attr_reader :risk_reasons # @!visibility private def initialize(record, locales) if record super else super({}, locales) end if record @location = Minfraud::Model::GeoIP2Location.new(record.fetch('location', nil)) else @location = Minfraud::Model::GeoIP2Location.new(nil) end if record @risk = record.fetch('risk', nil) else @risk = nil end @risk_reasons = [] if record&.key?('risk_reasons') record['risk_reasons'].each do |r| @risk_reasons << Minfraud::Model::IPRiskReason.new(r) end end # These attributes are deprecated and aren't in maxmind-geoip2. The # webservice still sends them as of writing, so we'd like to keep them # for now as they could still be providing value. @traits.define_singleton_method(:is_anonymous_proxy) { get('is_anonymous_proxy') } @traits.define_singleton_method(:is_satellite_provider) { get('is_satellite_provider') } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
minfraud-2.7.1 | lib/minfraud/model/ip_address.rb |
minfraud-2.7.0.beta1 | lib/minfraud/model/ip_address.rb |
minfraud-2.6.0 | lib/minfraud/model/ip_address.rb |