useragent 0.16.7 → 0.16.8
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.
- checksums.yaml +4 -4
- data/lib/user_agent/browsers.rb +4 -0
- data/lib/user_agent/browsers/edge.rb +1 -3
- data/lib/user_agent/browsers/vivaldi.rb +63 -0
- data/lib/user_agent/browsers/webkit.rb +1 -1
- data/lib/user_agent/browsers/wechat_browser.rb +44 -0
- data/lib/user_agent/operating_systems.rb +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 794ed3a8f61a1981fef4a6a41f308dc7b5e64d83
|
4
|
+
data.tar.gz: 2d08c890bb2b5cc9ed55a28e0ebdcc9acc3e925a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bdbad422b7325093c694d0c09b17b575770849443bd58b1b77b1572e6b85f3336e25352545299686585fda6019e09b5a8521036039204e58d9fa73a8f1fdb0d
|
7
|
+
data.tar.gz: 1c4a25d6443319c91d9644fc6b1dbbbb491c6fccc0317117fd4950a29e35bb0d5de0327cf8d04a4c901a09808478eb04575822b72d1ce6ebd3881756c40b5fb3
|
data/lib/user_agent/browsers.rb
CHANGED
@@ -5,12 +5,14 @@ require 'user_agent/browsers/gecko'
|
|
5
5
|
require 'user_agent/browsers/internet_explorer'
|
6
6
|
require 'user_agent/browsers/opera'
|
7
7
|
require 'user_agent/browsers/webkit'
|
8
|
+
require 'user_agent/browsers/wechat_browser'
|
8
9
|
require 'user_agent/browsers/windows_media_player'
|
9
10
|
require 'user_agent/browsers/itunes'
|
10
11
|
require 'user_agent/browsers/apple_core_media'
|
11
12
|
require 'user_agent/browsers/libavformat'
|
12
13
|
require 'user_agent/browsers/playstation'
|
13
14
|
require 'user_agent/browsers/podcast_addict'
|
15
|
+
require 'user_agent/browsers/vivaldi'
|
14
16
|
|
15
17
|
class UserAgent
|
16
18
|
module Browsers
|
@@ -24,6 +26,8 @@ class UserAgent
|
|
24
26
|
Edge,
|
25
27
|
InternetExplorer,
|
26
28
|
Opera,
|
29
|
+
WechatBrowser,
|
30
|
+
Vivaldi,
|
27
31
|
Chrome,
|
28
32
|
ITunes,
|
29
33
|
PlayStation,
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class UserAgent
|
2
|
+
module Browsers
|
3
|
+
class Vivaldi < Base
|
4
|
+
def self.extend?(agent)
|
5
|
+
agent.detect { |useragent| useragent.product == 'Vivaldi' }
|
6
|
+
end
|
7
|
+
|
8
|
+
def browser
|
9
|
+
'Vivaldi'
|
10
|
+
end
|
11
|
+
|
12
|
+
def build
|
13
|
+
webkit.version
|
14
|
+
end
|
15
|
+
|
16
|
+
def version
|
17
|
+
last.version
|
18
|
+
end
|
19
|
+
|
20
|
+
def application
|
21
|
+
self.reject { |agent| agent.comment.nil? || agent.comment.empty? }.first
|
22
|
+
end
|
23
|
+
|
24
|
+
def platform
|
25
|
+
return unless application
|
26
|
+
|
27
|
+
if application.comment[0] =~ /Windows/
|
28
|
+
'Windows'
|
29
|
+
elsif application.comment.any? { |c| c =~ /CrOS/ }
|
30
|
+
'ChromeOS'
|
31
|
+
elsif application.comment.any? { |c| c =~ /Android/ }
|
32
|
+
'Android'
|
33
|
+
else
|
34
|
+
application.comment[0]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def webkit
|
39
|
+
detect_product("AppleWebKit")
|
40
|
+
end
|
41
|
+
|
42
|
+
def os
|
43
|
+
return unless application
|
44
|
+
|
45
|
+
if application.comment[0] =~ /Windows NT/
|
46
|
+
OperatingSystems.normalize_os(application.comment[0])
|
47
|
+
elsif application.comment[2].nil?
|
48
|
+
OperatingSystems.normalize_os(application.comment[1])
|
49
|
+
elsif application.comment[1] =~ /Android/
|
50
|
+
OperatingSystems.normalize_os(application.comment[1])
|
51
|
+
else
|
52
|
+
OperatingSystems.normalize_os(application.comment[2])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def localization
|
57
|
+
return unless application
|
58
|
+
|
59
|
+
application.comment[3]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class UserAgent
|
2
|
+
module Browsers
|
3
|
+
class WechatBrowser < Base
|
4
|
+
def self.extend?(agent)
|
5
|
+
agent.detect { |useragent| useragent.product =~ /MicroMessenger/i }
|
6
|
+
end
|
7
|
+
|
8
|
+
def browser
|
9
|
+
'Wechat Browser'
|
10
|
+
end
|
11
|
+
|
12
|
+
def version
|
13
|
+
micro_messenger = detect_product("MicroMessenger")
|
14
|
+
Version.new(micro_messenger.version)
|
15
|
+
end
|
16
|
+
|
17
|
+
def platform
|
18
|
+
return unless application
|
19
|
+
|
20
|
+
if application.comment[0] =~ /iPhone/
|
21
|
+
'iPhone'
|
22
|
+
elsif application.comment.any? { |c| c =~ /Android/ }
|
23
|
+
'Android'
|
24
|
+
else
|
25
|
+
application.comment[0]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def os
|
30
|
+
return unless application
|
31
|
+
|
32
|
+
if application.comment[0] =~ /Windows NT/
|
33
|
+
OperatingSystems.normalize_os(application.comment[0])
|
34
|
+
elsif application.comment[2].nil?
|
35
|
+
OperatingSystems.normalize_os(application.comment[1])
|
36
|
+
elsif application.comment[1] =~ /Android/
|
37
|
+
OperatingSystems.normalize_os(application.comment[1])
|
38
|
+
else
|
39
|
+
OperatingSystems.normalize_os(application.comment[2])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -39,7 +39,7 @@ class UserAgent
|
|
39
39
|
if $1.nil?
|
40
40
|
"iOS"
|
41
41
|
else
|
42
|
-
version = $1.
|
42
|
+
version = $1.tr('_', '.')
|
43
43
|
"iOS #{version}"
|
44
44
|
end
|
45
45
|
end
|
@@ -50,7 +50,7 @@ class UserAgent
|
|
50
50
|
if $1.nil?
|
51
51
|
"OS X"
|
52
52
|
else
|
53
|
-
version = $1.
|
53
|
+
version = $1.tr('_', '.')
|
54
54
|
"OS X #{version}"
|
55
55
|
end
|
56
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: useragent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Peek
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-09-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -39,8 +39,7 @@ dependencies:
|
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '3.0'
|
42
|
-
description:
|
43
|
-
HTTP User Agent parser
|
42
|
+
description: HTTP User Agent parser
|
44
43
|
email: garry@robustsoftware.co.uk
|
45
44
|
executables: []
|
46
45
|
extensions: []
|
@@ -61,13 +60,15 @@ files:
|
|
61
60
|
- lib/user_agent/browsers/opera.rb
|
62
61
|
- lib/user_agent/browsers/playstation.rb
|
63
62
|
- lib/user_agent/browsers/podcast_addict.rb
|
63
|
+
- lib/user_agent/browsers/vivaldi.rb
|
64
64
|
- lib/user_agent/browsers/webkit.rb
|
65
|
+
- lib/user_agent/browsers/wechat_browser.rb
|
65
66
|
- lib/user_agent/browsers/windows_media_player.rb
|
66
67
|
- lib/user_agent/comparable.rb
|
67
68
|
- lib/user_agent/operating_systems.rb
|
68
69
|
- lib/user_agent/version.rb
|
69
70
|
- lib/useragent.rb
|
70
|
-
homepage:
|
71
|
+
homepage: https://github.com/gshutler/useragent
|
71
72
|
licenses:
|
72
73
|
- MIT
|
73
74
|
metadata: {}
|