Class: Signature5VerificationResult

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-common/v5/Signature5VerificationResult.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Signature5VerificationResult

Returns a new instance of Signature5VerificationResult.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 73

def initialize(hash)
  @zone_id = hash.delete('zone_id')&.to_i
  @result = hash.delete('result')&.to_i
  @verdict = hash.delete('verdict')
  @visitor_user_agent = hash.delete('b.ua')
  @data = hash.delete('data')
  @ipv4_ip = hash.delete('ipv4.ip')
  @ipv4_v = hash.delete('ipv4.v')&.to_i
  @ipv6_ip = hash.delete('ipv6.ip')
  @ipv6_v = hash.delete('ipv6.v')&.to_i
  @cpu_cores = hash.delete('b.cpucores')&.to_i
  @ram = hash.delete('b.ram')&.to_i
  @tz_offset = hash.delete('b.tzoffset')&.to_i
  @b_platform = hash.delete('b.platform')
  @platform_v = hash.delete('b.platform.v')
  @gpu = hash.delete('b.gpu')
  @apple_sense = hash.delete('apple_sense')
  @horizontal_resolution = hash.delete('b.sr.w')&.to_i
  @vertical_resolution = hash.delete('b.sr.h')&.to_i
  @true_ua = hash.delete('b.trueua')
  @true_ua_location = hash.delete('b.trueloc.c')
  @true_ua_location_c = hash.delete('b.truech.location.c')&.to_i
  @truech_ua = hash.delete('b.truech.ua')
  @truech_arch = hash.delete('b.truech.arch')
  @truech_bitness = hash.delete('b.truech.bitness')&.to_i
  @truech_model = hash.delete('b.truech.model')
  @truech_platform = hash.delete('b.truech.platform')
  @truech_platform_v = hash.delete('b.truech.platform.v')
  @truech_full_v = hash.delete('b.truech.full.v')
  @truech_mobile = hash.delete('b.truech.mobile')
  @incognito = hash.delete('incognito')
  @sub_id = hash.delete('sub_id')
  @request_time = hash.delete('requestTime')&.to_i
  @signature_time = hash.delete('signatureTime')&.to_i
  @token = hash.delete('token')
  @additional_data = hash
end

Instance Attribute Details

#additional_dataObject

Other, which has not been mapped to a field, or getting error during parsing



71
72
73
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 71

def additional_data
  @additional_data
end

#apple_senseObject

Detected iPhone/iPad model by Adscore AppleSense



33
34
35
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 33

def apple_sense
  @apple_sense
end

#b_platformObject

User-Agent Client Hints Platform



27
28
29
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 27

def b_platform
  @b_platform
end

#cpu_coresObject

Number of CPU logical cores gathered from navigator.hardwareConcurrency



21
22
23
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 21

def cpu_cores
  @cpu_cores
end

#dataObject

Data



11
12
13
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 11

def data
  @data
end

#gpuObject

GPU Model obtained from WebGL and WebGPU APIs



31
32
33
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 31

def gpu
  @gpu
end

#horizontal_resolutionObject

Physical screen horizontal resolution



35
36
37
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 35

def horizontal_resolution
  @horizontal_resolution
end

#incognitoObject

Indicates whether visitor is using Private Browsing (Incognito) Mode



61
62
63
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 61

def incognito
  @incognito
end

#ipv4_ipObject

IPv4 address



13
14
15
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 13

def ipv4_ip
  @ipv4_ip
end

#ipv4_vObject

Number of bytes required for IP matching



15
16
17
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 15

def ipv4_v
  @ipv4_v
end

#ipv6_ipObject

IPv6 address



17
18
19
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 17

def ipv6_ip
  @ipv6_ip
end

#ipv6_vObject

Number of left-most bytes of IPv6 address needed to match



19
20
21
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 19

def ipv6_v
  @ipv6_v
end

#platform_vObject

Content of Sec-CH-UA-Platform-Version request header



29
30
31
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 29

def platform_v
  @platform_v
end

#ramObject

Amount of RAM memory in GB gathered from navigator.deviceMemory



23
24
25
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 23

def ram
  @ram
end

#request_timeObject

Request time



65
66
67
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 65

def request_time
  @request_time
end

#resultObject

Detection result as number, one of following: 0, 3, 6, 9



5
6
7
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 5

def result
  @result
end

#signature_timeObject

Signature time



67
68
69
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 67

def signature_time
  @signature_time
end

#sub_idObject

Adscore zone subId



63
64
65
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 63

def sub_id
  @sub_id
end

#tokenObject

Token



69
70
71
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 69

def token
  @token
end

#true_uaObject

Adscore TrueUA-enriched User-Agent



39
40
41
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 39

def true_ua
  @true_ua
end

#true_ua_locationObject

Adscore True Location Country



41
42
43
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 41

def true_ua_location
  @true_ua_location
end

#true_ua_location_cObject

Adscore True Location Confidence



43
44
45
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 43

def true_ua_location_c
  @true_ua_location_c
end

#truech_archObject

Adscore TrueUA-enriched Client Hints header Sec-CH-UA-Arch



47
48
49
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 47

def truech_arch
  @truech_arch
end

#truech_bitnessObject

Adscore TrueUA-enriched Client Hints header Sec-CH-UA-Bitness



49
50
51
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 49

def truech_bitness
  @truech_bitness
end

#truech_full_vObject

Adscore TrueUA-enriched Client Hints header Sec-CH-UA-Full-Version



57
58
59
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 57

def truech_full_v
  @truech_full_v
end

#truech_mobileObject

Adscore TrueUA-enriched Client Hints header Sec-CH-UA-Mobile



59
60
61
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 59

def truech_mobile
  @truech_mobile
end

#truech_modelObject

Adscore TrueUA-enriched Client Hints header Sec-CH-UA-Model



51
52
53
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 51

def truech_model
  @truech_model
end

#truech_platformObject

Adscore TrueUA-enriched Client Hints header Sec-CH-UA-Platform



53
54
55
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 53

def truech_platform
  @truech_platform
end

#truech_platform_vObject

Adscore TrueUA-enriched Client Hints header Sec-CH-UA-Platform-Version



55
56
57
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 55

def truech_platform_v
  @truech_platform_v
end

#truech_uaObject

Adscore TrueUA-enriched Client Hints header Sec-CH-UA



45
46
47
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 45

def truech_ua
  @truech_ua
end

#tz_offsetObject

Timezone offset from GMT in minutes



25
26
27
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 25

def tz_offset
  @tz_offset
end

#verdictObject

Detection result as text, one of following: ok, junk, proxy, bot



7
8
9
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 7

def verdict
  @verdict
end

#vertical_resolutionObject

Physical screen vertical resolution



37
38
39
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 37

def vertical_resolution
  @vertical_resolution
end

#visitor_user_agentObject

Visitor’s User Agent



9
10
11
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 9

def visitor_user_agent
  @visitor_user_agent
end

#zone_idObject

Zone-id



3
4
5
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 3

def zone_id
  @zone_id
end

Instance Method Details

#to_sObject



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/ruby-common/v5/Signature5VerificationResult.rb', line 111

def to_s
  <<~STRING
    Zone ID: #{@zone_id}
    Result: #{@result}
    Verdict: #{@verdict}
    Visitor User Agent: #{@visitor_user_agent}
    Data: #{@data}
    IPv4 IP: #{@ipv4_ip}
    IPv4 Version: #{@ipv4_v}
    IPv6 IP: #{@ipv6_ip}
    IPv6 Version: #{@ipv6_v}
    CPU Cores: #{@cpu_cores}
    RAM: #{@ram}
    Time Zone Offset: #{@tz_offset}
    Browser Platform: #{@b_platform}
    Platform Version: #{@platform_v}
    GPU: #{@gpu}
    Apple Sense: #{@apple_sense}
    Horizontal Resolution: #{@horizontal_resolution}
    Vertical Resolution: #{@vertical_resolution}
    True User Agent: #{@true_ua}
    True User Agent Location: #{@true_ua_location}
    True User Agent Location Code: #{@true_ua_location_c}
    Truech User Agent: #{@truech_ua}
    Truech Architecture: #{@truech_arch}
    Truech Bitness: #{@truech_bitness}
    Truech Model: #{@truech_model}
    Truech Platform: #{@truech_platform}
    Truech Platform Version: #{@truech_platform_v}
    Truech Full Version: #{@truech_full_v}
    Truech Mobile: #{@truech_mobile}
    Incognito: #{@incognito}
    Subscriber ID: #{@sub_id}
    Request Time: #{@request_time}
    Signature Time: #{@signature_time}
    Token: #{@token}
    Additional Data: #{@additional_data}
  STRING
end