useragent 0.13.1 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/user_agent/browsers/base.rb +26 -0
- data/lib/user_agent/browsers/opera.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f69cf2d44084d828233a9ba572469fc80fd0fb1
|
4
|
+
data.tar.gz: 7b27952c2d2299f6c8b4ed06134a57bee214ec90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aee118761c02ab4e4d30aa3650e1c43cd7465e986b57f86faead6ddc9d2e00338a1e4e3543518e617efd44f0c660514c023c30dab963a1c22cfdd6bf6dc0b50
|
7
|
+
data.tar.gz: 7d5c68eb6f3cd951858045e3f870d5bdda079c6ee9de44d0e0af1cb342e180a5780733331c60036d275ad8507a14eddadb124b6ff6556b022ca5bd3dd31d1040
|
@@ -87,6 +87,32 @@ class UserAgent
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
def to_h
|
91
|
+
return nil unless application
|
92
|
+
|
93
|
+
hash = {
|
94
|
+
:browser => browser,
|
95
|
+
:platform => platform,
|
96
|
+
:os => os,
|
97
|
+
:mobile => mobile?,
|
98
|
+
:bot => bot?,
|
99
|
+
}
|
100
|
+
|
101
|
+
if version
|
102
|
+
hash[:version] = version.to_a
|
103
|
+
else
|
104
|
+
hash[:version] = nil
|
105
|
+
end
|
106
|
+
|
107
|
+
if comment = application.comment
|
108
|
+
hash[:comment] = comment.dup
|
109
|
+
else
|
110
|
+
hash[:comment] = nil
|
111
|
+
end
|
112
|
+
|
113
|
+
hash
|
114
|
+
end
|
115
|
+
|
90
116
|
private
|
91
117
|
def detect_product(product)
|
92
118
|
detect { |useragent| useragent.product.to_s.downcase == product.to_s.downcase }
|
@@ -16,6 +16,8 @@ class UserAgent
|
|
16
16
|
application.comment.detect{|c| c =~ /Opera Mini/}[/Opera Mini\/([\d\.]+)/, 1] rescue Version.new
|
17
17
|
elsif product = detect_product('Version')
|
18
18
|
product.version
|
19
|
+
elsif product = detect_product('OPR')
|
20
|
+
product.version
|
19
21
|
else
|
20
22
|
super
|
21
23
|
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.13.
|
4
|
+
version: 0.13.2
|
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: 2015-03-
|
12
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|