user_agent_sanitizer 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/user_agent_sanitizer.rb +18 -8
- data/spec/user_agent_sanitizer_spec.rb +71 -48
- data/user_agent_sanitizer.gemspec +2 -2
- metadata +3 -3
data/lib/user_agent_sanitizer.rb
CHANGED
@@ -61,8 +61,12 @@ module UserAgentSanitizer
|
|
61
61
|
result.gsub!(/^SAMSUNG/i, 'Samsung')
|
62
62
|
result.gsub!(/^GT/i, 'Samsung GT')
|
63
63
|
result.gsub!(/^Samsung GT\s+/i, 'Samsung GT-')
|
64
|
-
result.gsub!(/^
|
64
|
+
result.gsub!(/^Nexus/i, 'HTC Nexus')
|
65
|
+
result.gsub!(/^Galaxy Nexus/i, 'Samsung Galaxy Nexus')
|
65
66
|
result.gsub!(/^iPhone/i, 'Apple iPhone')
|
67
|
+
if result =~ /^(HTC Wildfire [a-z]+) \w+/i
|
68
|
+
result = $1.strip
|
69
|
+
end
|
66
70
|
result = "SonyEricsson #{$1}" if result =~ /^SonyEricsson(\w+)/i
|
67
71
|
result.strip!
|
68
72
|
result.squeeze!(" ")
|
@@ -84,12 +88,17 @@ module UserAgentSanitizer
|
|
84
88
|
return "#{$1} #{$2}"
|
85
89
|
when /(Blackberry) ?(\d+)/i
|
86
90
|
return "#{$1} #{$2}"
|
87
|
-
when /Sensation(\w+)/i
|
91
|
+
when /(Sensation|Desire|Wildfire)(\w+)/i
|
92
|
+
@brand = "HTC"
|
93
|
+
@model = "#{$1.capitalize} #{$2.gsub("_", " ")}".squeeze(" ").split(" ").reject{|str| str =~ /^[a-z][0-9]/i}.join(" ")
|
94
|
+
return nil
|
95
|
+
when /HTC_(One)_?([a-z]+)?/i
|
88
96
|
@brand = "HTC"
|
89
|
-
@model =
|
97
|
+
@model = [$1, $2].compact.join(" ")
|
90
98
|
return nil
|
91
|
-
when /(HTC)[_\/]([a-z0-9]+)
|
92
|
-
|
99
|
+
when /(HTC)[_\/]([a-z0-9]+)/i
|
100
|
+
result = [$1, $2, $3].compact.join(" ")
|
101
|
+
return result
|
93
102
|
when /(Samsung)[\/\-]([a-z0-9]+)([\/\-]([a-z0-9]+))?/i
|
94
103
|
return ['Samsung', $2, $4].compact.join(" ")
|
95
104
|
when /(iPod|iPad)/
|
@@ -100,9 +109,9 @@ module UserAgentSanitizer
|
|
100
109
|
@brand = 'Sony'
|
101
110
|
@model = 'PSP'
|
102
111
|
return nil
|
103
|
-
when /Opera Mobi/
|
112
|
+
when /Opera (Mobi|Mini)/
|
104
113
|
@brand = 'Opera'
|
105
|
-
@model =
|
114
|
+
@model = $1
|
106
115
|
return nil
|
107
116
|
when /(Windows NT \w+(\.\w+)+)/
|
108
117
|
@brand = "Microsoft"
|
@@ -113,7 +122,8 @@ module UserAgentSanitizer
|
|
113
122
|
@model = $2
|
114
123
|
return nil
|
115
124
|
when /\((Linux; U; Android.*)\)/
|
116
|
-
|
125
|
+
result = $1.split(";").last.split("/").first.gsub(/build/i, "").strip
|
126
|
+
return result
|
117
127
|
when /((#{BRANDS.join("|")}).*?)\//i
|
118
128
|
result=$1
|
119
129
|
|
@@ -4,57 +4,80 @@ require 'user_agent_sanitizer'
|
|
4
4
|
|
5
5
|
describe UserAgentSanitizer do
|
6
6
|
DEVICES = {
|
7
|
-
|
8
|
-
'BlackBerry8520/4.6.1.296 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/150' => ['BlackBerry', '8520'],
|
9
|
-
'BlackBerry8900/4.6.1.199 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/302' => ['BlackBerry', '8900'],
|
10
|
-
'HTC_Touch2_T3333 Opera/9.50 (Windows NT 5.1; U; nl)' => ['HTC','Touch2'],
|
11
|
-
'LG-GD510/V100 Teleca/WAP2.0 Profile/MIDP-2.1 Configuration/CLDC-1.1' => ['LG', 'GD510'],
|
12
|
-
'LG/KU990/v10a Browser/Obigo-Q05A/3.6 MMS/LG-MMS-V1.0/1.2 Java/ASVM/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1' => ['LG','KU990'],
|
13
|
-
'Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; nl) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+' => ['BlackBerry','9800'],
|
14
|
-
'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3' => ['Apple','iPhone'],
|
15
|
-
'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5' => ['Apple','iPhone'],
|
16
|
-
'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; nl-nl) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419.3' => ['Apple','iPhone'],
|
17
|
-
'Mozilla/5.0 (Linux; U; Android 1.5; en-gb; HTC Magic Build/CRB17) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1' => ['HTC','Magic'],
|
18
|
-
'Mozilla/5.0 (Linux; U; Android 1.5; nl-nl; GT-I5700 Build/CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1' => ['Samsung','GT-I5700'],
|
19
|
-
'Mozilla/5.0 (Linux; U; Android 1.6; nl-nl; SonyEricssonX10i Build/R1FA016) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1' => ['SonyEricsson','X10i'],
|
20
|
-
'Mozilla/5.0 (Linux; U; Android 2.1-update1; nl-nl; Desire_A8181 Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17' => ['HTC','Desire'],
|
21
|
-
'Mozilla/5.0 (Linux; U; Android 2.1; nl-nl; HTC Legend Build/ERD79) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17' => ['HTC','Legend'],
|
22
|
-
'Mozilla/5.0 (Linux; U; Android 2.2.1; es-es; Vodafone 858 Build/Vodafone858C02B617) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Vodafone','858'],
|
23
|
-
'Mozilla/5.0 (Linux; U; Android 2.2; es-es; Light Pro Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Light','Pro'],
|
24
|
-
'Mozilla/5.0 (Linux; U; Android 2.2; nl-nl; HTC_DesireZ_A7272 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC','DesireZ'],
|
25
|
-
'Mozilla/5.0 (Linux; U; Android 2.3.3; nl-nl; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Samsung','GT-I9100'],
|
26
|
-
'Mozilla/5.0 (Linux; U; Android 2.3.3; nl-nl; HTC/DesireS/1.32.161.2 Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC','DesireS'],
|
27
|
-
'Mozilla/5.0 (Linux; U; Android 2.3.3; nl-nl; SAMSUNG GT-I9100/I9100BUKE5 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Samsung','GT-I9100'],
|
28
|
-
'Mozilla/5.0 (Linux; U; Android 2.3.5; es-es; ZTE Skate Build/V1.0.0B03) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['ZTE','Skate'],
|
29
|
-
'Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus One Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Nexus','One'],
|
30
|
-
'Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-S8500/S8500XXJEC; U; Bada/1.0; nl-nl) AppleWebKit/533.1 (KHTML, like Gecko) Dolfin/2.0 Mobile WVGA SMM-MMS/1.2.0 OPN-B' => ['Samsung','GT-S8500'],
|
31
|
-
'Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE90-1/07.24.0.3; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413' => ['Nokia','E90'],
|
32
|
-
'Mozilla/5.0 (SymbianOS/9.3; U; Series60/3.2 NokiaE75-1/110.48.125 Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413' => ['Nokia','E75'],
|
33
|
-
'Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Samsung/I8910; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 Safari/525' => ['Samsung','I8910'],
|
34
|
-
'Opera/9.80 (BlackBerry; Opera Mini/5.1.22303/24.871; U; pt) Presto/2.5.25 Version/10.54' => ['BlackBerry', ''],
|
35
|
-
'SAGEM-my411C/1.0/ MIDP-2.0 Configuration/CLDC-1.1 Browser/UP.Browser/7.2.6.c.1.386 (GUI)' => ['SAGEM','my411C'],
|
36
|
-
'SAMSUNG-GT-C3510/C3510XXIL4 NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1' => ['Samsung','GT-C3510'],
|
37
|
-
'SAMSUNG-SGH-L600/L600ASGI3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0' => ['Samsung','SGH L600'],
|
38
|
-
'SEC-SGHM620/1.0 Openwave/6.2.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0' => ['SEC','SGH M620'],
|
39
|
-
'SonyEricssonW995/R1FA Browser/NetFront/3.4 Profile/MIDP-2.1 Configuration/CLDC-1.1 JavaPlatform/JP-8.4.3' => ['SonyEricsson','W995'],
|
40
|
-
'(compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 800)' => ['Nokia','Lumia 800'],
|
41
|
-
'"Mozilla/5.0 (Linux; U; Android 4.0.3; nl-nl; SensationXE_Beats_Z715e Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"' => ['HTC','Sensation XE Beats Z715e'],
|
7
|
+
### Mobile devices
|
42
8
|
|
43
|
-
|
44
|
-
|
9
|
+
# Apple
|
10
|
+
'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3' => ['Apple', 'iPhone'],
|
11
|
+
'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5' => ['Apple', 'iPhone'],
|
12
|
+
'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; nl-nl) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419.3' => ['Apple', 'iPhone'],
|
45
13
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
14
|
+
# Blackberry
|
15
|
+
'BlackBerry8520/4.6.1.296 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/150' => ['BlackBerry', '8520'],
|
16
|
+
'BlackBerry8900/4.6.1.199 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/302' => ['BlackBerry', '8900'],
|
17
|
+
'Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; nl) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+' => ['BlackBerry', '9800'],
|
50
18
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
19
|
+
# HTC
|
20
|
+
'HTC_Touch2_T3333 Opera/9.50 (Windows NT 5.1; U; nl)' => ['HTC', 'Touch2'],
|
21
|
+
'Mozilla/5.0 (Linux; U; Android 1.5; en-gb; HTC Magic Build/CRB17) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1' => ['HTC', 'Magic'],
|
22
|
+
'Mozilla/5.0 (Linux; U; Android 2.1-update1; nl-nl; Desire_A8181 Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17' => ['HTC', 'Desire'],
|
23
|
+
'Mozilla/5.0 (Linux; U; Android 2.3.5; nl-nl; HTC_DesireHD_A9191 Build/GRJ90) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC', 'Desire HD'],
|
24
|
+
'Mozilla/5.0 (Linux; U; Android 2.1; nl-nl; HTC Legend Build/ERD79) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17' => ['HTC', 'Legend'],
|
25
|
+
'Mozilla/5.0 (Linux; U; Android 2.2; nl-nl; HTC_DesireZ_A7272 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC', 'Desire Z'],
|
26
|
+
'Mozilla/5.0 (Linux; U; Android 2.3.3; nl-nl; HTC/DesireS/1.32.161.2 Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC', 'Desire S'],
|
27
|
+
'Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus One Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC', 'Nexus One'],
|
28
|
+
'Mozilla/5.0 (Linux; U; Android 4.0.3; nl-nl; SensationXE_Beats_Z715e Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30' => ['HTC', 'Sensation XE Beats'],
|
29
|
+
'Mozilla/5.0 (Linux; U; Android 4.0.3; nl-nl; HTC_One_X Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30' => ['HTC', 'One X'],
|
30
|
+
'Mozilla/5.0 (Linux; U; Android 2.2.1; nl-nl; HTC_Wildfire_A3333 Build/FRG83D) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC', 'Wildfire'],
|
31
|
+
'Mozilla/5.0 (Linux; U; Android 2.3.5; nl-nl; HTC_WildfireS_A510e Build/GRJ90) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC', 'Wildfire S'],
|
32
|
+
'Mozilla/5.0 (Linux; U; Android 2.3.5; nl-nl; HTC Wildfire S A510e Build/GRJ90) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['HTC', 'Wildfire S'],
|
33
|
+
|
34
|
+
# LG
|
35
|
+
'LG-GD510/V100 Teleca/WAP2.0 Profile/MIDP-2.1 Configuration/CLDC-1.1' => ['LG', 'GD510'],
|
36
|
+
'LG/KU990/v10a Browser/Obigo-Q05A/3.6 MMS/LG-MMS-V1.0/1.2 Java/ASVM/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1' => ['LG', 'KU990'],
|
37
|
+
|
38
|
+
# Nokia
|
39
|
+
'Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE90-1/07.24.0.3; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413' => ['Nokia', 'E90'],
|
40
|
+
'Mozilla/5.0 (SymbianOS/9.3; U; Series60/3.2 NokiaE75-1/110.48.125 Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413' => ['Nokia', 'E75'],
|
41
|
+
'(compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 800)' => ['Nokia', 'Lumia 800'],
|
42
|
+
|
43
|
+
# Samsung
|
44
|
+
'Mozilla/5.0 (Linux; U; Android 1.5; nl-nl; GT-I5700 Build/CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1' => ['Samsung', 'GT-I5700'],
|
45
|
+
'Mozilla/5.0 (Linux; U; Android 2.3.3; nl-nl; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Samsung', 'GT-I9100'],
|
46
|
+
'Mozilla/5.0 (Linux; U; Android 2.3.3; nl-nl; SAMSUNG GT-I9100/I9100BUKE5 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Samsung', 'GT-I9100'],
|
47
|
+
'Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-S8500/S8500XXJEC; U; Bada/1.0; nl-nl) AppleWebKit/533.1 (KHTML, like Gecko) Dolfin/2.0 Mobile WVGA SMM-MMS/1.2.0 OPN-B' => ['Samsung', 'GT-S8500'],
|
48
|
+
'Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Samsung/I8910; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 Safari/525' => ['Samsung', 'I8910'],
|
49
|
+
'SAMSUNG-GT-C3510/C3510XXIL4 NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1' => ['Samsung', 'GT-C3510'],
|
50
|
+
'SAMSUNG-SGH-L600/L600ASGI3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0' => ['Samsung', 'SGH L600'],
|
51
|
+
'Mozilla/5.0 (Linux; U; Android 4.1.1; nl-nl; Galaxy Nexus Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30' => ['Samsung', 'Galaxy Nexus'],
|
52
|
+
|
53
|
+
# SonyEricsson
|
54
|
+
'Mozilla/5.0 (Linux; U; Android 1.6; nl-nl; SonyEricssonX10i Build/R1FA016) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1' => ['SonyEricsson', 'X10i'],
|
55
|
+
'SonyEricssonW995/R1FA Browser/NetFront/3.4 Profile/MIDP-2.1 Configuration/CLDC-1.1 JavaPlatform/JP-8.4.3' => ['SonyEricsson', 'W995'],
|
56
|
+
|
57
|
+
# Other
|
58
|
+
'Mozilla/5.0 (Linux; U; Android 2.2.1; es-es; Vodafone 858 Build/Vodafone858C02B617) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Vodafone', '858'],
|
59
|
+
'Mozilla/5.0 (Linux; U; Android 2.2; es-es; Light Pro Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['Light', 'Pro'],
|
60
|
+
'Mozilla/5.0 (Linux; U; Android 2.3.5; es-es; ZTE Skate Build/V1.0.0B03) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => ['ZTE', 'Skate'],
|
61
|
+
'SAGEM-my411C/1.0/ MIDP-2.0 Configuration/CLDC-1.1 Browser/UP.Browser/7.2.6.c.1.386 (GUI)' => ['SAGEM', 'my411C'],
|
62
|
+
'SEC-SGHM620/1.0 Openwave/6.2.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0' => ['SEC', 'SGH M620'],
|
63
|
+
|
64
|
+
# Mobile browsers
|
65
|
+
'(Android 4.0.3; Linux; Opera Mobi/ADR-1205181138; U; nl) Presto/2.10.254 Version/12.00' => ['Opera', 'Mobi'],
|
66
|
+
'Opera/9.80 (BlackBerry; Opera Mini/5.1.22303/24.871; U; pt) Presto/2.5.25 Version/10.54' => ['Opera', 'Mini'],
|
67
|
+
|
68
|
+
# Tables and other handhelds
|
69
|
+
'(iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3' => ['Apple', 'iPad'],
|
70
|
+
'(PSP (PlayStation Portable); 2.00)' => ['Sony', 'PSP'],
|
71
|
+
'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F190 Safari/6533.18.5' => ['Apple', 'iPod'],
|
72
|
+
|
73
|
+
# Desktop
|
74
|
+
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618)' => ['Microsoft', 'Windows NT 6.0'],
|
75
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0' => ['Apple', 'Mac OS X 10.7'],
|
76
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5' => ['Apple', 'Mac OS X 10.7.4'],
|
77
|
+
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; nl-nl) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1' => ['Apple', 'Mac OS X 10.5.5'],
|
78
|
+
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10' => ['Apple', 'Mac OS X 10.6.2'],
|
79
|
+
'(Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10' => ['Microsoft', 'Windows NT 6.1'],
|
80
|
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)' => ['Microsoft', 'Windows NT 6.1'],
|
58
81
|
}
|
59
82
|
describe "sanitize_user_agent" do
|
60
83
|
DEVICES.each do |user_agent, brand_model|
|
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.name = 'user_agent_sanitizer'
|
4
4
|
s.summary = "Browser user agent sanitizer"
|
5
5
|
s.description = "Browser user agent sanitizer, with a focus on sanitizing mobile phone user agents to brand + model number"
|
6
|
-
s.version = '2.0.
|
7
|
-
s.date = '2012-07-
|
6
|
+
s.version = '2.0.3'
|
7
|
+
s.date = '2012-07-31'
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Wes Oldenbeuving"]
|
10
10
|
s.email = "narnach@gmail.com"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_agent_sanitizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Browser user agent sanitizer, with a focus on sanitizing mobile phone
|
15
15
|
user agents to brand + model number
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 1.8.
|
54
|
+
rubygems_version: 1.8.23
|
55
55
|
signing_key:
|
56
56
|
specification_version: 3
|
57
57
|
summary: Browser user agent sanitizer
|