user_agent_parser 2.13.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f014ae2d784eb25f63242a361c9c9186ad108c7199fd1655944da1dcfeaff28
4
- data.tar.gz: 36357407d451f17dada0fa4115f5f19e8a69af6932a1c3fc999ecd55abc958a0
3
+ metadata.gz: 39b8973f5d52a0f8a2528513b7c6c6cbe3d7bc7a34b8015d24b5838a6c861857
4
+ data.tar.gz: a19d0963a602f508e8885dac2e2ebf0083ec1a933c28cf744bd30a10aa98ed43
5
5
  SHA512:
6
- metadata.gz: 1dfc2207de8b2345dcf21a0f271122f96259165fe115397ecb290f9fb07a9924e399554a5f23110c27f24976feae5b189a9a482386bb9f60d74ce542625eda61
7
- data.tar.gz: 7abd96ee88bcca1d800323d3d9fd2f508b0b36dc20885a79e5bdfb58154a48a00ed60b0f7750e3eb0fd6570bbbebaac48355f5ba250c35f05ace615c41baa5d5
6
+ metadata.gz: 1cf0b39ca84e370eeb9d2c1791228197ea178f2b6024108b3261288e31f3b85bd63bae8d852f7954203b70db8bac7de04033939358c5883c2913270944a35535
7
+ data.tar.gz: e1ec5f53e7e319bf2ff5ab9b5030227558bcdc561b0a9cf721e18280a001080646d5e2e05e9510f977382c0be5ad5ada0a68e2a03854efdb66fdc3fcfc322728
@@ -39,6 +39,36 @@ module UserAgentParser
39
39
  parse_ua(user_agent, os, device)
40
40
  end
41
41
 
42
+ def parse_os(user_agent)
43
+ pattern, match = first_pattern_match(@os_patterns, user_agent)
44
+
45
+ if match
46
+ os_from_pattern_match(pattern, match)
47
+ else
48
+ OperatingSystem.new
49
+ end
50
+ end
51
+
52
+ def parse_device(user_agent)
53
+ pattern, match = first_pattern_match(@device_patterns, user_agent)
54
+
55
+ if match
56
+ device_from_pattern_match(pattern, match)
57
+ else
58
+ Device.new
59
+ end
60
+ end
61
+
62
+ def parse_ua(user_agent, os = nil, device = nil)
63
+ pattern, match = first_pattern_match(@ua_patterns, user_agent)
64
+
65
+ if match
66
+ user_agent_from_pattern_match(pattern, match, os, device)
67
+ else
68
+ UserAgent.new(nil, nil, os, device)
69
+ end
70
+ end
71
+
42
72
  def patterns_path
43
73
  patterns_paths.first
44
74
  end
@@ -76,36 +106,6 @@ module UserAgentParser
76
106
  end
77
107
  end
78
108
 
79
- def parse_ua(user_agent, os = nil, device = nil)
80
- pattern, match = first_pattern_match(@ua_patterns, user_agent)
81
-
82
- if match
83
- user_agent_from_pattern_match(pattern, match, os, device)
84
- else
85
- UserAgent.new(nil, nil, os, device)
86
- end
87
- end
88
-
89
- def parse_os(user_agent)
90
- pattern, match = first_pattern_match(@os_patterns, user_agent)
91
-
92
- if match
93
- os_from_pattern_match(pattern, match)
94
- else
95
- OperatingSystem.new
96
- end
97
- end
98
-
99
- def parse_device(user_agent)
100
- pattern, match = first_pattern_match(@device_patterns, user_agent)
101
-
102
- if match
103
- device_from_pattern_match(pattern, match)
104
- else
105
- Device.new
106
- end
107
- end
108
-
109
109
  def first_pattern_match(patterns, value)
110
110
  patterns.each do |pattern|
111
111
  return [pattern, pattern[:regex].match(value)] if pattern[:regex].match?(value)
@@ -932,7 +932,7 @@ user_agent_parsers:
932
932
  family_replacement: 'Python Requests'
933
933
 
934
934
  # headless user-agents
935
- - regex: '\b(Windows-Update-Agent|WindowsPowerShell|Microsoft-CryptoAPI|SophosUpdateManager|SophosAgent|Debian APT-HTTP|Ubuntu APT-HTTP|libcurl-agent|libwww-perl|urlgrabber|curl|PycURL|Wget|wget2|aria2|Axel|OpenBSD ftp|lftp|jupdate|insomnia|fetch libfetch|akka-http|got|CloudCockpitBackend|ReactorNetty|axios|Jersey|Vert.x-WebClient|Apache-CXF|Go-CF-client|go-resty|AHC)(?:[ /](\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)'
935
+ - regex: '\b(Windows-Update-Agent|WindowsPowerShell|Microsoft-CryptoAPI|SophosUpdateManager|SophosAgent|Debian APT-HTTP|Ubuntu APT-HTTP|libcurl-agent|libwww-perl|urlgrabber|curl|PycURL|Wget|wget2|aria2|Axel|OpenBSD ftp|lftp|jupdate|insomnia|fetch libfetch|akka-http|got|CloudCockpitBackend|ReactorNetty|axios|Jersey|Vert.x-WebClient|Apache-CXF|Go-CF-client|go-resty|AHC|HTTPie)(?:[ /](\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)'
936
936
 
937
937
  # CloudFoundry
938
938
  - regex: '^(cf)\/(\d+)\.(\d+)\.(\S+)'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_agent_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Lucas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-21 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  A simple, comprehensive Ruby gem for parsing user agent strings
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  requirements: []
51
- rubygems_version: 3.3.24
51
+ rubygems_version: 3.4.10
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: Parsing user agent strings with the help of BrowserScope's UA database