user_agent 1.1.0 → 1.1.1
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.rb +64 -30
- data/lib/user_agent/version.rb +1 -1
- data/spec/user_agent_spec.rb +17 -1
- data/spec/user_agents_spec.rb +54 -42
- metadata +5 -6
data/lib/user_agent.rb
CHANGED
@@ -17,6 +17,7 @@ class UserAgent
|
|
17
17
|
Safari = /version\/([\d\w\.\-]+)/i
|
18
18
|
Ps3 = /([\d\w\.\-]+)\)\s*$/i
|
19
19
|
Psp = /([\d\w\.\-]+)\)?\s*$/i
|
20
|
+
Lotus = /Lotus-Notes\/([\w.]+)/i
|
20
21
|
end
|
21
22
|
|
22
23
|
module Browsers
|
@@ -28,6 +29,13 @@ class UserAgent
|
|
28
29
|
PS3 = /playstation 3/i
|
29
30
|
PSP = /playstation portable/i
|
30
31
|
Firefox = /firefox/i
|
32
|
+
Lotus = /lotus.notes/i
|
33
|
+
Netscape = /netscape/i
|
34
|
+
SeaMonkey = /seamonkey/i
|
35
|
+
Thunderbird = /thunderbird/i
|
36
|
+
Outlook = /microsoft.outlook/i
|
37
|
+
Evolution = /evolution/i
|
38
|
+
IEMobile = /iemobile|windows phone/i
|
31
39
|
end
|
32
40
|
|
33
41
|
module OS
|
@@ -36,6 +44,8 @@ class UserAgent
|
|
36
44
|
Windows2003 = /windows nt 5\.2/i
|
37
45
|
WindowsXP = /windows nt 5\.1/i
|
38
46
|
Windows2000 = /windows nt 5\.0/i
|
47
|
+
WindowsPhone = /windows (ce|phone|mobile)( os)?/i
|
48
|
+
Windows = /windows/i
|
39
49
|
OSX = /os x (\d+)[._](\d+)/i
|
40
50
|
Linux = /linux/i
|
41
51
|
Wii = /wii/i
|
@@ -43,6 +53,7 @@ class UserAgent
|
|
43
53
|
PSP = /playstation portable/i
|
44
54
|
Ipad = /\(iPad.*os (\d+)[._](\d+)/i
|
45
55
|
Iphone = /\(iPhone.*os (\d+)[._](\d+)/i
|
56
|
+
Symbian = /symbian(os)?/i
|
46
57
|
end
|
47
58
|
|
48
59
|
module Platform
|
@@ -56,8 +67,12 @@ class UserAgent
|
|
56
67
|
Iphone = /iphone/i
|
57
68
|
Android = /android/i
|
58
69
|
Blackberry = /blackberry/i
|
70
|
+
WindowsPhone = /windows (ce|phone|mobile)( os)?/i
|
71
|
+
Symbian = /symbian(os)?/i
|
59
72
|
end
|
60
73
|
|
74
|
+
MobilePlatforms = [:android, :blackberry, :ipad, :ipod, :iphone, :symbian, :windows_phone]
|
75
|
+
|
61
76
|
def self.engine(string)
|
62
77
|
case string
|
63
78
|
when Engines::Webkit then :webkit
|
@@ -66,6 +81,7 @@ class UserAgent
|
|
66
81
|
when Engines::Chrome then :chrome
|
67
82
|
when Engines::Presto then :presto
|
68
83
|
when Engines::Gecko then :gecko
|
84
|
+
when /opera/i then :unknown
|
69
85
|
when Engines::Msie then :msie
|
70
86
|
else
|
71
87
|
:unknown
|
@@ -80,14 +96,21 @@ class UserAgent
|
|
80
96
|
|
81
97
|
def self.browser_name(string)
|
82
98
|
case string
|
83
|
-
when Browsers::Konqueror
|
84
|
-
when Browsers::Chrome
|
85
|
-
when Browsers::Safari
|
86
|
-
when Browsers::
|
87
|
-
when Browsers::
|
88
|
-
when Browsers::
|
89
|
-
when Browsers::
|
90
|
-
when Browsers::
|
99
|
+
when Browsers::Konqueror then :konqueror
|
100
|
+
when Browsers::Chrome then :chrome
|
101
|
+
when Browsers::Safari then :safari
|
102
|
+
when Browsers::Opera then :opera
|
103
|
+
when Browsers::PS3 then :ps3
|
104
|
+
when Browsers::PSP then :psp
|
105
|
+
when Browsers::Firefox then :firefox
|
106
|
+
when Browsers::Lotus then :lotus
|
107
|
+
when Browsers::Netscape then :netscape
|
108
|
+
when Browsers::SeaMonkey then :seamonkey
|
109
|
+
when Browsers::Thunderbird then :thunderbird
|
110
|
+
when Browsers::Outlook then :outlook
|
111
|
+
when Browsers::Evolution then :evolution
|
112
|
+
when Browsers::IEMobile then :iemobile
|
113
|
+
when Browsers::IE then :ie
|
91
114
|
else
|
92
115
|
:unknown
|
93
116
|
end
|
@@ -103,6 +126,8 @@ class UserAgent
|
|
103
126
|
$1 if string =~ Versions::Ps3
|
104
127
|
when :psp
|
105
128
|
$1 if string =~ Versions::Psp
|
129
|
+
when :lotus
|
130
|
+
$1 if string =~ Versions::Lotus
|
106
131
|
else
|
107
132
|
$1 if string =~ /#{name}[\/ ]([\d\w\.\-]+)/i
|
108
133
|
end
|
@@ -110,18 +135,21 @@ class UserAgent
|
|
110
135
|
|
111
136
|
def self.os(string)
|
112
137
|
case string
|
113
|
-
when OS::
|
114
|
-
when OS::
|
115
|
-
when OS::
|
116
|
-
when OS::
|
117
|
-
when OS::
|
118
|
-
when OS::
|
119
|
-
when OS::
|
120
|
-
when OS::
|
121
|
-
when OS::
|
122
|
-
when OS::
|
123
|
-
when OS::
|
124
|
-
when OS::
|
138
|
+
when OS::WindowsPhone then 'Windows Phone'
|
139
|
+
when OS::WindowsVista then 'Windows Vista'
|
140
|
+
when OS::Windows7 then 'Windows 7'
|
141
|
+
when OS::Windows2003 then 'Windows 2003'
|
142
|
+
when OS::WindowsXP then 'Windows XP'
|
143
|
+
when OS::Windows2000 then 'Windows 2000'
|
144
|
+
when OS::Windows then 'Windows'
|
145
|
+
when OS::OSX then "OS X #{$1}.#{$2}"
|
146
|
+
when OS::Linux then 'Linux'
|
147
|
+
when OS::Wii then 'Wii'
|
148
|
+
when OS::PS3 then 'Playstation'
|
149
|
+
when OS::PSP then 'Playstation'
|
150
|
+
when OS::Ipad then "iPad OS #{$1}.#{$2}"
|
151
|
+
when OS::Iphone then "iPhone OS #{$1}.#{$2}"
|
152
|
+
when Platform::Symbian then "Symbian OS"
|
125
153
|
else
|
126
154
|
'Unknown'
|
127
155
|
end
|
@@ -129,16 +157,18 @@ class UserAgent
|
|
129
157
|
|
130
158
|
def self.platform(string)
|
131
159
|
case string
|
132
|
-
when Platform::
|
133
|
-
when Platform::
|
134
|
-
when Platform::
|
135
|
-
when Platform::
|
136
|
-
when Platform::
|
137
|
-
when Platform::
|
138
|
-
when Platform::
|
139
|
-
when Platform::
|
140
|
-
when Platform::
|
141
|
-
when Platform::
|
160
|
+
when Platform::WindowsPhone then :windows_phone
|
161
|
+
when Platform::Windows then :windows
|
162
|
+
when Platform::Mac then :macintosh
|
163
|
+
when Platform::Android then :android
|
164
|
+
when Platform::Blackberry then :blackberry
|
165
|
+
when Platform::Linux then :linux
|
166
|
+
when Platform::Wii then :wii
|
167
|
+
when Platform::Playstation then :playstation
|
168
|
+
when Platform::Ipad then :ipad
|
169
|
+
when Platform::Ipod then :ipod
|
170
|
+
when Platform::Iphone then :iphone
|
171
|
+
when Platform::Symbian then :symbian
|
142
172
|
else
|
143
173
|
:unknown
|
144
174
|
end
|
@@ -174,6 +204,10 @@ class UserAgent
|
|
174
204
|
@platform ||= self.class.platform(source)
|
175
205
|
end
|
176
206
|
|
207
|
+
def mobile?
|
208
|
+
MobilePlatforms.include?(platform) || name == :psp
|
209
|
+
end
|
210
|
+
|
177
211
|
def to_s
|
178
212
|
@source
|
179
213
|
end
|
data/lib/user_agent/version.rb
CHANGED
data/spec/user_agent_spec.rb
CHANGED
@@ -41,6 +41,22 @@ describe UserAgent do
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
describe "#mobile?" do
|
45
|
+
it "returs true for mobile platform" do
|
46
|
+
agent = UserAgent.new('Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1')
|
47
|
+
agent.should be_mobile
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns true for psp" do
|
51
|
+
agent = UserAgent.new('PSP (PlayStation Portable); 2.00')
|
52
|
+
agent.should be_mobile
|
53
|
+
end
|
54
|
+
|
55
|
+
it "returns false for not mobile platform" do
|
56
|
+
@agent.should_not be_mobile
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
44
60
|
describe "#to_s" do
|
45
61
|
it "should return the user agent string" do
|
46
62
|
@agent.to_s.should == @agent.source
|
@@ -98,4 +114,4 @@ describe UserAgent do
|
|
98
114
|
a.should_not == b
|
99
115
|
end
|
100
116
|
end
|
101
|
-
end
|
117
|
+
end
|
data/spec/user_agents_spec.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require File.expand_path('../spec_helper', __FILE__)
|
2
2
|
|
3
|
-
def test(name, version, platform, os, engine, engine_version, source)
|
3
|
+
def test(mobile, name, version, platform, os, engine, engine_version, source)
|
4
4
|
it "should parse #{name} #{version} on #{os} with engine #{engine} #{engine_version}" do
|
5
5
|
agent = UserAgent.new(source)
|
6
|
+
agent.mobile?.should == mobile
|
6
7
|
agent.name.should == name
|
7
8
|
agent.platform.should == platform
|
8
9
|
agent.os.should == os
|
@@ -14,46 +15,57 @@ end
|
|
14
15
|
|
15
16
|
describe UserAgent do
|
16
17
|
|
17
|
-
test :safari, '4.0dp1', :windows, 'Windows XP', :webkit, '526.9', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'
|
18
|
-
test :safari, '4.0.3', :windows, 'Windows Vista', :webkit, '531.9', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9'
|
19
|
-
test :safari, '4.0.2', :windows, 'Windows 7', :webkit, '532', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532+ (KHTML, like Gecko) Version/4.0.2 Safari/530.19.1'
|
20
|
-
test :safari, '4.0.1', :macintosh, 'OS X 10.5', :webkit, '531.2', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/4.0.1 Safari/530.18'
|
21
|
-
test :safari, '4.0', :windows, 'Windows Vista', :webkit, '528.16', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; ru-RU) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16'
|
22
|
-
test :safari, '3.2.3', :windows, 'Windows XP', :webkit, '525.28.3', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29'
|
23
|
-
test :safari, '4.0.4', :ipad, 'iPad OS 3.2', :webkit, '531.21.10', 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'
|
24
|
-
test :safari, '4.0.4', :ipad, 'iPad OS 3.2', :webkit, '531.21.10', 'Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'
|
25
|
-
test :safari, '4.0', :iphone, 'iPhone OS 3.0', :webkit, '528.18', 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16'
|
26
|
-
test :safari, '4.0', :android, 'Linux', :webkit, '533.1', 'Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'
|
27
|
-
test :ie, '8.0', :windows, 'Windows 7', :msie, '8.0', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)'
|
28
|
-
test :ie, '7.0b', :windows, 'Windows 2003', :msie, '7.0b', 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30)'
|
29
|
-
test :ie, '7.0', :windows, 'Windows XP', :msie, '7.0', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)'
|
30
|
-
test :ie, '7.0', :windows, 'Windows XP', :msie, '7.0', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; MSOffice 12)'
|
31
|
-
test :ie, '6.0b', :windows, 'Windows XP', :msie, '6.0b', 'Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)'
|
32
|
-
test :ie, '6.0', :windows, 'Windows XP', :msie, '6.0', 'Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)'
|
33
|
-
test :opera, '9.99', :windows, 'Windows XP', :presto, '9.9.9', 'Opera/9.99 (Windows NT 5.1; U; pl) Presto/9.9.9'
|
34
|
-
test :opera, '9.70', :linux, 'Linux', :gecko, '20061208', 'Mozilla/5.0 (Linux i686 ; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.70'
|
35
|
-
test :opera, '9.64', :linux, 'Linux', :presto, '2.1.1', 'Opera/9.64 (X11; Linux i686; U; Linux Mint; it) Presto/2.1.1'
|
36
|
-
test :opera, '9.00', :wii, 'Wii', :unknown, nil, 'Opera/9.00 (Nintindo Wii; U; ; 103858; Wii Shop Channel/1.0; en)'
|
37
|
-
test :chrome, '6.0.472.62', :macintosh, 'OS X 10.6', :webkit, '534.3', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3'
|
38
|
-
test :chrome, '6.0.472.63', :macintosh, 'OS X 10.6', :webkit, '534.3', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3'
|
39
|
-
test :chrome, '6.0.472.55', :linux, 'Linux', :webkit, '534.3', 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.55 Safari/534.3'
|
40
|
-
test :chrome, '5.0.375.127', :windows, 'Windows XP', :webkit, '533.4', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Safari/533.4'
|
41
|
-
test :chrome, '6.0.472.59', :windows, 'Windows XP', :webkit, '534.3', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.59 Safari/534.3'
|
42
|
-
test :chrome, '6.0.472.53', :linux, 'Linux', :webkit, '534.3', 'Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.53 Safari/534.3'
|
43
|
-
test :chrome, '4.0.202.2', :linux, 'Linux', :webkit, '532.0', 'Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.202.2 Safari/532.0'
|
44
|
-
test :chrome, '0.2.149.27', :windows, 'Windows 2003', :webkit, '525.13', 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13 '
|
45
|
-
test :chrome, '0.2.149.30', :windows, 'Windows Vista', :webkit, '525.13', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.30 Safari/525.13 '
|
46
|
-
test :konqueror, '4.2', :linux, 'Linux', :khtml, '4.2.4', 'Mozilla/5.0 (compatible; Konqueror/4.2; Linux; X11; x86_64) KHTML/4.2.4 (like Gecko) Fedora/4.2.4-2.fc11'
|
47
|
-
test :konqueror, '3.1-rc6', :linux, 'Linux', :konqueror, '3.1-rc6', 'Mozilla/5.0 (compatible; Konqueror/3.1-rc6; i686 Linux; 20021105)'
|
48
|
-
test :ps3, '2.00', :playstation, 'Playstation', :unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 2.00)'
|
49
|
-
test :ps3, '1.10', :playstation, 'Playstation', :unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 1.10)'
|
50
|
-
test :psp, '2.00', :playstation, 'Playstation', :unknown, nil, 'PSP (PlayStation Portable); 2.00'
|
51
|
-
test :psp, '2.00', :playstation, 'Playstation', :unknown, nil, 'Mozilla/4.0 (PSP (PlayStation Portable); 2.00)'
|
52
|
-
test :firefox, '3.5.13', :windows, 'Windows XP', :gecko, '20100914', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.13) Gecko/20100914 Firefox/3.5.13 (.NET CLR 3.5.30729)'
|
53
|
-
test :firefox, '3.6.10', :windows, 'Windows XP', :gecko, '20100914', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 GTB7.1'
|
54
|
-
test :firefox, '3.6.10', :windows, 'Windows Vista', :gecko, '20100914', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; pt-BR; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 GTB7.1 ( .NET CLR 3.5.30729)'
|
55
|
-
test :firefox, '3.6.8', :linux, 'Linux', :gecko, '20100723', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100723 Ubuntu/9.10 (karmic) Firefox/3.6.8'
|
56
|
-
test :firefox, '3.6.9', :linux, 'Linux', :gecko, '20100824', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9'
|
57
|
-
test :firefox, '3.6.9', :linux, 'Linux', :gecko, '20100825', 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100825 Ubuntu/10.04 (lucid) Firefox/3.6.9'
|
18
|
+
test false, :safari, '4.0dp1', :windows, 'Windows XP', :webkit, '526.9', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'
|
19
|
+
test false, :safari, '4.0.3', :windows, 'Windows Vista', :webkit, '531.9', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9'
|
20
|
+
test false, :safari, '4.0.2', :windows, 'Windows 7', :webkit, '532', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532+ (KHTML, like Gecko) Version/4.0.2 Safari/530.19.1'
|
21
|
+
test false, :safari, '4.0.1', :macintosh, 'OS X 10.5', :webkit, '531.2', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/4.0.1 Safari/530.18'
|
22
|
+
test false, :safari, '4.0', :windows, 'Windows Vista', :webkit, '528.16', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; ru-RU) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16'
|
23
|
+
test false, :safari, '3.2.3', :windows, 'Windows XP', :webkit, '525.28.3', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29'
|
24
|
+
test true, :safari, '4.0.4', :ipad, 'iPad OS 3.2', :webkit, '531.21.10', 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'
|
25
|
+
test true, :safari, '4.0.4', :ipad, 'iPad OS 3.2', :webkit, '531.21.10', 'Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'
|
26
|
+
test true, :safari, '4.0', :iphone, 'iPhone OS 3.0', :webkit, '528.18', 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16'
|
27
|
+
test true, :safari, '4.0', :android, 'Linux', :webkit, '533.1', 'Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'
|
28
|
+
test false, :ie, '8.0', :windows, 'Windows 7', :msie, '8.0', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)'
|
29
|
+
test false, :ie, '7.0b', :windows, 'Windows 2003', :msie, '7.0b', 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30)'
|
30
|
+
test false, :ie, '7.0', :windows, 'Windows XP', :msie, '7.0', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)'
|
31
|
+
test false, :ie, '7.0', :windows, 'Windows XP', :msie, '7.0', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; MSOffice 12)'
|
32
|
+
test false, :ie, '6.0b', :windows, 'Windows XP', :msie, '6.0b', 'Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)'
|
33
|
+
test false, :ie, '6.0', :windows, 'Windows XP', :msie, '6.0', 'Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)'
|
34
|
+
test false, :opera, '9.99', :windows, 'Windows XP', :presto, '9.9.9', 'Opera/9.99 (Windows NT 5.1; U; pl) Presto/9.9.9'
|
35
|
+
test false, :opera, '9.70', :linux, 'Linux', :gecko, '20061208', 'Mozilla/5.0 (Linux i686 ; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.70'
|
36
|
+
test false, :opera, '9.64', :linux, 'Linux', :presto, '2.1.1', 'Opera/9.64 (X11; Linux i686; U; Linux Mint; it) Presto/2.1.1'
|
37
|
+
test false, :opera, '9.00', :wii, 'Wii', :unknown, nil, 'Opera/9.00 (Nintindo Wii; U; ; 103858; Wii Shop Channel/1.0; en)'
|
38
|
+
test false, :chrome, '6.0.472.62', :macintosh, 'OS X 10.6', :webkit, '534.3', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3'
|
39
|
+
test false, :chrome, '6.0.472.63', :macintosh, 'OS X 10.6', :webkit, '534.3', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3'
|
40
|
+
test false, :chrome, '6.0.472.55', :linux, 'Linux', :webkit, '534.3', 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.55 Safari/534.3'
|
41
|
+
test false, :chrome, '5.0.375.127', :windows, 'Windows XP', :webkit, '533.4', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Safari/533.4'
|
42
|
+
test false, :chrome, '6.0.472.59', :windows, 'Windows XP', :webkit, '534.3', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.59 Safari/534.3'
|
43
|
+
test false, :chrome, '6.0.472.53', :linux, 'Linux', :webkit, '534.3', 'Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.53 Safari/534.3'
|
44
|
+
test false, :chrome, '4.0.202.2', :linux, 'Linux', :webkit, '532.0', 'Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.202.2 Safari/532.0'
|
45
|
+
test false, :chrome, '0.2.149.27', :windows, 'Windows 2003', :webkit, '525.13', 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13 '
|
46
|
+
test false, :chrome, '0.2.149.30', :windows, 'Windows Vista', :webkit, '525.13', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.30 Safari/525.13 '
|
47
|
+
test false, :konqueror, '4.2', :linux, 'Linux', :khtml, '4.2.4', 'Mozilla/5.0 (compatible; Konqueror/4.2; Linux; X11; x86_64) KHTML/4.2.4 (like Gecko) Fedora/4.2.4-2.fc11'
|
48
|
+
test false, :konqueror, '3.1-rc6', :linux, 'Linux', :konqueror, '3.1-rc6', 'Mozilla/5.0 (compatible; Konqueror/3.1-rc6; i686 Linux; 20021105)'
|
49
|
+
test false, :ps3, '2.00', :playstation, 'Playstation', :unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 2.00)'
|
50
|
+
test false, :ps3, '1.10', :playstation, 'Playstation', :unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 1.10)'
|
51
|
+
test true, :psp, '2.00', :playstation, 'Playstation', :unknown, nil, 'PSP (PlayStation Portable); 2.00'
|
52
|
+
test true, :psp, '2.00', :playstation, 'Playstation', :unknown, nil, 'Mozilla/4.0 (PSP (PlayStation Portable); 2.00)'
|
53
|
+
test false, :firefox, '3.5.13', :windows, 'Windows XP', :gecko, '20100914', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.13) Gecko/20100914 Firefox/3.5.13 (.NET CLR 3.5.30729)'
|
54
|
+
test false, :firefox, '3.6.10', :windows, 'Windows XP', :gecko, '20100914', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 GTB7.1'
|
55
|
+
test false, :firefox, '3.6.10', :windows, 'Windows Vista', :gecko, '20100914', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; pt-BR; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 GTB7.1 ( .NET CLR 3.5.30729)'
|
56
|
+
test false, :firefox, '3.6.8', :linux, 'Linux', :gecko, '20100723', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100723 Ubuntu/9.10 (karmic) Firefox/3.6.8'
|
57
|
+
test false, :firefox, '3.6.9', :linux, 'Linux', :gecko, '20100824', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9'
|
58
|
+
test false, :firefox, '3.6.9', :linux, 'Linux', :gecko, '20100825', 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100825 Ubuntu/10.04 (lucid) Firefox/3.6.9'
|
59
|
+
test false, :opera, '7.21', :windows, 'Windows', :unknown, nil, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) Opera 7.21 [pt-BR]'
|
60
|
+
test false, :lotus, '6.0', :windows, 'Windows', :unknown, nil, 'Mozilla/4.0 (compatible; Lotus-Notes/6.0; Windows-NT)'
|
61
|
+
test false, :thunderbird, '2.0.0.23', :windows, 'Windows XP', :gecko, '20090812', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23'
|
62
|
+
test false, :netscape, '7.1', :windows, 'Windows XP', :gecko, '20030624', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'
|
63
|
+
test false, :seamonkey, '2.0.13', :windows, 'Windows Vista', :gecko, '20110320', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.18) Gecko/20110320 SeaMonkey/2.0.13'
|
64
|
+
test false, :outlook, '14.0.6025', :windows, 'Windows 7', :msie, '7.0', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET4.0C; .NET4.0E; InfoPath.3; Microsoft Outlook 14.0.6025; ms-office; MSOffice 14)'
|
65
|
+
test false, :evolution, '2.32.2', :unknown, 'Unknown', :unknown, nil, 'CamelHttpStream/1.0 Evolution/2.32.2'
|
66
|
+
test true, :iemobile, '7.6', :windows_phone, 'Windows Phone', :msie, '6.0', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6)'
|
67
|
+
test true, :iemobile, nil, :windows_phone, 'Windows Phone', :msie, '6.0', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Windows Phone 6.5.3.5)'
|
68
|
+
test true, :iemobile, '7.0', :windows_phone, 'Windows Phone', :msie, '7.0', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; HTC; 7 Mozart; Orange)'
|
69
|
+
test true, :safari, nil, :symbian, 'Symbian OS', :webkit, '413', 'Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE71-3/300.21.012; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413'
|
58
70
|
|
59
71
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- TJ Holowaychuk
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-10-05 00:00:00 Z
|
20
20
|
dependencies: []
|
21
21
|
|
22
22
|
description: User agent parser
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements: []
|
72
72
|
|
73
73
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.8.9
|
75
75
|
signing_key:
|
76
76
|
specification_version: 3
|
77
77
|
summary: User agent parser
|
@@ -80,4 +80,3 @@ test_files:
|
|
80
80
|
- spec/spec_helper.rb
|
81
81
|
- spec/user_agent_spec.rb
|
82
82
|
- spec/user_agents_spec.rb
|
83
|
-
has_rdoc:
|