browser_sniffer 1.1.2 → 1.1.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.
- checksums.yaml +4 -4
- data/lib/browser_sniffer/patterns.rb +15 -0
- data/lib/browser_sniffer/version.rb +1 -1
- data/test/shopify_agents_test.rb +126 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd1a593002b74a298902288af9c9ad850599246545788da8ec5282661ace4b72
|
4
|
+
data.tar.gz: e51a161b66ef5e9f237e498fed82c101ee55dcfd85493a2003743cdbf305be43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcce3cb34e52ffe1d43b5ee06f96d7093effce03cef846c709d7addc06555266edcd2f1b0d5b0879d5a5bae17e2f46d78cc64a939bc45e5a229f9575106f9011
|
7
|
+
data.tar.gz: 4a2b2a8995d1e2b7cc6c9aa61bcbb839f63dae0963cd7513eb2ad88fae1755dc39713c730d8d74b0e51ec7a1257f5e4e87fde5a8bed88c87c9837e69f969c6fc
|
@@ -69,6 +69,9 @@ class BrowserSniffer
|
|
69
69
|
# Shopify Mobile for iPhone or iPad
|
70
70
|
%r{.*(Shopify Mobile)\/(?:iPhone\sOS|iOS)\/([\d\.]+) \((iPhone|iPad|iPod)}i
|
71
71
|
], [[:name, 'Shopify Mobile'], :version], [
|
72
|
+
# Shopify POS Next for iPhone or iPad
|
73
|
+
%r{.*(Shopify POS Next|Shopify POS)\/(?:iOS)\/([\d\.]+) \((iPhone|iPad|iPod)}i
|
74
|
+
], [[:name, 'Shopify POS'], :version], [
|
72
75
|
# Shopify Mobile for Android
|
73
76
|
%r{.*(Shopify Mobile)\/Android\/([\d\.]+(?: \(debug(?:|-push)\))?) \(Build (\d+) with API (\d+)}i
|
74
77
|
], [[:name, 'Shopify Mobile'], :version, :build, :sdk_version], [
|
@@ -158,6 +161,15 @@ class BrowserSniffer
|
|
158
161
|
], [[:type, :tablet], :model], [
|
159
162
|
# Shopify Mobile for iPod touch
|
160
163
|
%r{.*Shopify Mobile/(?:iPhone\sOS|iOS)/[\d\.]+ \((iPod)([\d,]+)}i
|
164
|
+
], [[:type, :handheld], :model], [
|
165
|
+
# Shopify POS Next for iPhone
|
166
|
+
%r{.*(?:Shopify POS Next|Shopify POS)/(?:iPhone\sOS|iOS)/[\d\.]+ \((iPhone)([\d,]+)}i
|
167
|
+
], [[:type, :handheld], :model], [
|
168
|
+
# Shopify POS Next for iPad
|
169
|
+
%r{.*(?:Shopify POS Next|Shopify POS)/(?:iPhone\sOS|iOS)/[\d\.]+ \((iPad)([\d,]+)}i
|
170
|
+
], [[:type, :tablet], :model], [
|
171
|
+
# Shopify POS Next for iPod touch
|
172
|
+
%r{.*(?:Shopify POS Next|Shopify POS)/(?:iPhone\sOS|iOS)/[\d\.]+ \((iPod)([\d,]+)}i
|
161
173
|
], [[:type, :handheld], :model], [
|
162
174
|
# Shopify Ping for iPhone
|
163
175
|
%r{.*Shopify Ping/(?:iPhone\sOS|iOS)/[\d\.]+ \((iPhone)([\d,]+)}i
|
@@ -278,6 +290,9 @@ class BrowserSniffer
|
|
278
290
|
], [[:type, :ios], [:version, lambda { |str| str && str.scan(/\d+/).join(".") }], [:name, 'iOS']], [
|
279
291
|
# Shopify Mobile for iPhone or iPad
|
280
292
|
%r{.*(Shopify Mobile)\/(?:iPhone\sOS|iOS)[\/\d\.]* \((iPhone|iPad|iPod).*\/([\d\.]+)\)}i
|
293
|
+
], [[:type, :ios], [:name, 'iOS'], :version], [
|
294
|
+
# Shopify POS Next for iPhone or iPad
|
295
|
+
%r{.*(Shopify POS Next|Shopify POS)\/(?:iPhone\sOS|iOS)[\/\d\.]* \((iPhone|iPad|iPod).*\/([\d\.]+)\)}i
|
281
296
|
], [[:type, :ios], [:name, 'iOS'], :version], [
|
282
297
|
# Shopify Ping for iOS
|
283
298
|
%r{.*Shopify Ping\/(iOS)\/[\d\.]+ \(.*\/([\d\.]+)\)}i
|
data/test/shopify_agents_test.rb
CHANGED
@@ -252,6 +252,48 @@ describe "Shopify agents" do
|
|
252
252
|
}), sniffer.os_info
|
253
253
|
end
|
254
254
|
|
255
|
+
it "Shopify POS on iPhone with modern user agent can be sniffed" do
|
256
|
+
user_agent = "Shopify POS/iOS/3.12.1 (iPhone10,2/com.jadedpixel.pos/10.3.1)"
|
257
|
+
sniffer = BrowserSniffer.new(user_agent)
|
258
|
+
|
259
|
+
assert_equal ({
|
260
|
+
name: 'Shopify POS',
|
261
|
+
version: '3.12.1',
|
262
|
+
}), sniffer.browser_info
|
263
|
+
|
264
|
+
assert_equal ({
|
265
|
+
type: :handheld,
|
266
|
+
model: '10,2',
|
267
|
+
}), sniffer.device_info
|
268
|
+
|
269
|
+
assert_equal ({
|
270
|
+
type: :ios,
|
271
|
+
version: '10.3.1',
|
272
|
+
name: 'iOS',
|
273
|
+
}), sniffer.os_info
|
274
|
+
end
|
275
|
+
|
276
|
+
it "Shopify POS Next on iPhone with modern user agent can be sniffed" do
|
277
|
+
user_agent = "Shopify POS Next/iOS/3.12.1 (iPhone10,2/com.jadedpixel.pos/10.3.1)"
|
278
|
+
sniffer = BrowserSniffer.new(user_agent)
|
279
|
+
|
280
|
+
assert_equal ({
|
281
|
+
name: 'Shopify POS',
|
282
|
+
version: '3.12.1',
|
283
|
+
}), sniffer.browser_info
|
284
|
+
|
285
|
+
assert_equal ({
|
286
|
+
type: :handheld,
|
287
|
+
model: '10,2',
|
288
|
+
}), sniffer.device_info
|
289
|
+
|
290
|
+
assert_equal ({
|
291
|
+
type: :ios,
|
292
|
+
version: '10.3.1',
|
293
|
+
name: 'iOS',
|
294
|
+
}), sniffer.os_info
|
295
|
+
end
|
296
|
+
|
255
297
|
it "Shopify POS on iPod touch can be sniffed" do
|
256
298
|
user_agent = "Shopify POS/3.12.1 (iPod touch; iOS 9.3.5; Scale/2.00)"
|
257
299
|
sniffer = BrowserSniffer.new(user_agent)
|
@@ -273,6 +315,48 @@ describe "Shopify agents" do
|
|
273
315
|
}), sniffer.os_info
|
274
316
|
end
|
275
317
|
|
318
|
+
it "Shopify POS on iPod touch with modern user agent can be sniffed" do
|
319
|
+
user_agent = "Shopify POS/iOS/3.12.1 (iPod5,2/com.jadedpixel.pos/10.3.1)"
|
320
|
+
sniffer = BrowserSniffer.new(user_agent)
|
321
|
+
|
322
|
+
assert_equal ({
|
323
|
+
name: 'Shopify POS',
|
324
|
+
version: '3.12.1',
|
325
|
+
}), sniffer.browser_info
|
326
|
+
|
327
|
+
assert_equal ({
|
328
|
+
type: :handheld,
|
329
|
+
model: '5,2',
|
330
|
+
}), sniffer.device_info
|
331
|
+
|
332
|
+
assert_equal ({
|
333
|
+
type: :ios,
|
334
|
+
version: '10.3.1',
|
335
|
+
name: 'iOS',
|
336
|
+
}), sniffer.os_info
|
337
|
+
end
|
338
|
+
|
339
|
+
it "Shopify POS Next on iPod touch with modern user agent can be sniffed" do
|
340
|
+
user_agent = "Shopify POS Next/iOS/3.12.1 (iPod5,2/com.jadedpixel.pos/10.3.1)"
|
341
|
+
sniffer = BrowserSniffer.new(user_agent)
|
342
|
+
|
343
|
+
assert_equal ({
|
344
|
+
name: 'Shopify POS',
|
345
|
+
version: '3.12.1',
|
346
|
+
}), sniffer.browser_info
|
347
|
+
|
348
|
+
assert_equal ({
|
349
|
+
type: :handheld,
|
350
|
+
model: '5,2',
|
351
|
+
}), sniffer.device_info
|
352
|
+
|
353
|
+
assert_equal ({
|
354
|
+
type: :ios,
|
355
|
+
version: '10.3.1',
|
356
|
+
name: 'iOS',
|
357
|
+
}), sniffer.os_info
|
358
|
+
end
|
359
|
+
|
276
360
|
it "Shopify POS on iPad is detected as tablet" do
|
277
361
|
user_agent = "Shopify POS/3.10.12 (iPad; iOS 10.3.1; Scale/2.00)"
|
278
362
|
sniffer = BrowserSniffer.new(user_agent)
|
@@ -280,6 +364,48 @@ describe "Shopify agents" do
|
|
280
364
|
assert_equal :tablet, sniffer.form_factor
|
281
365
|
end
|
282
366
|
|
367
|
+
it "Shopify POS on iPad with modern user agent can be sniffed" do
|
368
|
+
user_agent = "Shopify POS/iOS/3.12.1 (iPad4,7/com.jadedpixel.pos/10.3.1)"
|
369
|
+
sniffer = BrowserSniffer.new(user_agent)
|
370
|
+
|
371
|
+
assert_equal ({
|
372
|
+
name: 'Shopify POS',
|
373
|
+
version: '3.12.1',
|
374
|
+
}), sniffer.browser_info
|
375
|
+
|
376
|
+
assert_equal ({
|
377
|
+
type: :tablet,
|
378
|
+
model: '4,7',
|
379
|
+
}), sniffer.device_info
|
380
|
+
|
381
|
+
assert_equal ({
|
382
|
+
type: :ios,
|
383
|
+
version: '10.3.1',
|
384
|
+
name: 'iOS',
|
385
|
+
}), sniffer.os_info
|
386
|
+
end
|
387
|
+
|
388
|
+
it "Shopify POS Next on iPad with modern user agent can be sniffed" do
|
389
|
+
user_agent = "Shopify POS Next/iOS/3.12.1 (iPad4,7/com.jadedpixel.pos/10.3.1)"
|
390
|
+
sniffer = BrowserSniffer.new(user_agent)
|
391
|
+
|
392
|
+
assert_equal ({
|
393
|
+
name: 'Shopify POS',
|
394
|
+
version: '3.12.1',
|
395
|
+
}), sniffer.browser_info
|
396
|
+
|
397
|
+
assert_equal ({
|
398
|
+
type: :tablet,
|
399
|
+
model: '4,7',
|
400
|
+
}), sniffer.device_info
|
401
|
+
|
402
|
+
assert_equal ({
|
403
|
+
type: :ios,
|
404
|
+
version: '10.3.1',
|
405
|
+
name: 'iOS',
|
406
|
+
}), sniffer.os_info
|
407
|
+
end
|
408
|
+
|
283
409
|
it "Shopify POS with okhttp user agent can be parsed" do
|
284
410
|
user_agent = "okhttp/3.6.0"
|
285
411
|
sniffer = BrowserSniffer.new(user_agent)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browser_sniffer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|