device_detector 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +5 -5
  4. data/lib/device_detector/device.rb +82 -3
  5. data/lib/device_detector/os.rb +4 -2
  6. data/lib/device_detector/parser.rb +1 -1
  7. data/lib/device_detector/version.rb +1 -1
  8. data/lib/device_detector/version_extractor.rb +20 -1
  9. data/regexes/bots.yml +49 -6
  10. data/regexes/client/browsers.yml +170 -16
  11. data/regexes/client/libraries.yml +20 -1
  12. data/regexes/client/mediaplayers.yml +2 -2
  13. data/regexes/client/mobile_apps.yml +447 -13
  14. data/regexes/client/pim.yml +16 -1
  15. data/regexes/device/consoles.yml +7 -1
  16. data/regexes/device/mobiles.yml +3169 -912
  17. data/regexes/device/portable_media_player.yml +16 -6
  18. data/regexes/oss.yml +380 -467
  19. metadata +3 -164
  20. data/.gitignore +0 -14
  21. data/.rubocop.yml +0 -49
  22. data/.ruby-version +0 -1
  23. data/.travis.yml +0 -14
  24. data/Gemfile +0 -8
  25. data/Rakefile +0 -86
  26. data/device_detector.gemspec +0 -27
  27. data/spec/device_detector/bot_fixtures_spec.rb +0 -30
  28. data/spec/device_detector/client_fixtures_spec.rb +0 -31
  29. data/spec/device_detector/concrete_user_agent_spec.rb +0 -123
  30. data/spec/device_detector/detector_fixtures_spec.rb +0 -99
  31. data/spec/device_detector/device_fixtures_spec.rb +0 -36
  32. data/spec/device_detector/device_spec.rb +0 -147
  33. data/spec/device_detector/memory_cache_spec.rb +0 -148
  34. data/spec/device_detector/model_extractor_spec.rb +0 -63
  35. data/spec/device_detector/os_fixtures_spec.rb +0 -26
  36. data/spec/device_detector/version_extractor_spec.rb +0 -79
  37. data/spec/device_detector_spec.rb +0 -189
  38. data/spec/fixtures/client/browser.yml +0 -3935
  39. data/spec/fixtures/client/feed_reader.yml +0 -187
  40. data/spec/fixtures/client/library.yml +0 -253
  41. data/spec/fixtures/client/mediaplayer.yml +0 -193
  42. data/spec/fixtures/client/mobile_app.yml +0 -703
  43. data/spec/fixtures/client/pim.yml +0 -175
  44. data/spec/fixtures/detector/bots.yml +0 -4434
  45. data/spec/fixtures/detector/camera.yml +0 -127
  46. data/spec/fixtures/detector/car_browser.yml +0 -217
  47. data/spec/fixtures/detector/console.yml +0 -343
  48. data/spec/fixtures/detector/desktop.yml +0 -7580
  49. data/spec/fixtures/detector/feature_phone.yml +0 -1597
  50. data/spec/fixtures/detector/feed_reader.yml +0 -524
  51. data/spec/fixtures/detector/mediaplayer.yml +0 -306
  52. data/spec/fixtures/detector/mobile_apps.yml +0 -1233
  53. data/spec/fixtures/detector/peripheral.yml +0 -271
  54. data/spec/fixtures/detector/phablet.yml +0 -7366
  55. data/spec/fixtures/detector/portable_media_player.yml +0 -527
  56. data/spec/fixtures/detector/smart_display.yml +0 -235
  57. data/spec/fixtures/detector/smart_speaker.yml +0 -60
  58. data/spec/fixtures/detector/smartphone-1.yml +0 -9622
  59. data/spec/fixtures/detector/smartphone-10.yml +0 -8981
  60. data/spec/fixtures/detector/smartphone-11.yml +0 -8938
  61. data/spec/fixtures/detector/smartphone-12.yml +0 -8989
  62. data/spec/fixtures/detector/smartphone-13.yml +0 -9412
  63. data/spec/fixtures/detector/smartphone-14.yml +0 -9477
  64. data/spec/fixtures/detector/smartphone-15.yml +0 -9281
  65. data/spec/fixtures/detector/smartphone-16.yml +0 -9678
  66. data/spec/fixtures/detector/smartphone-17.yml +0 -9965
  67. data/spec/fixtures/detector/smartphone-18.yml +0 -9806
  68. data/spec/fixtures/detector/smartphone-19.yml +0 -9965
  69. data/spec/fixtures/detector/smartphone-2.yml +0 -12242
  70. data/spec/fixtures/detector/smartphone-20.yml +0 -9710
  71. data/spec/fixtures/detector/smartphone-21.yml +0 -8693
  72. data/spec/fixtures/detector/smartphone-22.yml +0 -10178
  73. data/spec/fixtures/detector/smartphone-23.yml +0 -9453
  74. data/spec/fixtures/detector/smartphone-24.yml +0 -9843
  75. data/spec/fixtures/detector/smartphone-25.yml +0 -9703
  76. data/spec/fixtures/detector/smartphone-26.yml +0 -10007
  77. data/spec/fixtures/detector/smartphone-27.yml +0 -4927
  78. data/spec/fixtures/detector/smartphone-3.yml +0 -9909
  79. data/spec/fixtures/detector/smartphone-4.yml +0 -8954
  80. data/spec/fixtures/detector/smartphone-5.yml +0 -8981
  81. data/spec/fixtures/detector/smartphone-6.yml +0 -8948
  82. data/spec/fixtures/detector/smartphone-7.yml +0 -8975
  83. data/spec/fixtures/detector/smartphone-8.yml +0 -9810
  84. data/spec/fixtures/detector/smartphone-9.yml +0 -8925
  85. data/spec/fixtures/detector/smartphone.yml +0 -9001
  86. data/spec/fixtures/detector/tablet-1.yml +0 -10155
  87. data/spec/fixtures/detector/tablet-2.yml +0 -9064
  88. data/spec/fixtures/detector/tablet-3.yml +0 -9035
  89. data/spec/fixtures/detector/tablet-4.yml +0 -9062
  90. data/spec/fixtures/detector/tablet-5.yml +0 -9273
  91. data/spec/fixtures/detector/tablet-6.yml +0 -4588
  92. data/spec/fixtures/detector/tablet.yml +0 -8979
  93. data/spec/fixtures/detector/tv-1.yml +0 -2501
  94. data/spec/fixtures/detector/tv.yml +0 -10045
  95. data/spec/fixtures/detector/unknown.yml +0 -3071
  96. data/spec/fixtures/detector/wearable.yml +0 -915
  97. data/spec/fixtures/device/camera.yml +0 -19
  98. data/spec/fixtures/device/car_browser.yml +0 -13
  99. data/spec/fixtures/device/console.yml +0 -79
  100. data/spec/fixtures/device/notebook.yml +0 -7
  101. data/spec/fixtures/parser/oss.yml +0 -2418
  102. data/spec/fixtures/parser/vendorfragments.yml +0 -168
  103. data/spec/spec_helper.rb +0 -9
@@ -1,189 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'spec_helper'
4
-
5
- describe DeviceDetector do
6
- subject { DeviceDetector.new(user_agent) }
7
-
8
- alias_method :client, :subject
9
-
10
- describe 'known user agent' do
11
- describe 'desktop chrome browser' do
12
- let(:user_agent) { 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69' }
13
-
14
- describe '#name' do
15
- it 'returns the name' do
16
- value(client.name).must_equal 'Chrome'
17
- end
18
- end
19
-
20
- describe '#full_version' do
21
- it 'returns the full version' do
22
- value(client.full_version).must_equal '30.0.1599.69'
23
- end
24
- end
25
-
26
- describe '#os_family' do
27
- it 'returns the operating system name' do
28
- value(client.os_family).must_equal 'Mac'
29
- end
30
- end
31
-
32
- describe '#os_name' do
33
- it 'returns the operating system name' do
34
- value(client.os_name).must_equal 'Mac'
35
- end
36
- end
37
-
38
- describe '#os_full_version' do
39
- it 'returns the operating system full version' do
40
- value(client.os_full_version).must_equal '10.8.5'
41
- end
42
- end
43
-
44
- describe '#known?' do
45
- it 'returns true' do
46
- value(client.known?).must_equal true
47
- end
48
- end
49
-
50
- describe '#bot?' do
51
- it 'returns false' do
52
- value(client.bot?).must_equal false
53
- end
54
- end
55
-
56
- describe '#bot_name' do
57
- it 'returns nil' do
58
- value(client.bot_name).must_be_nil
59
- end
60
- end
61
- end
62
-
63
- describe 'ubuntu linux' do
64
- let(:user_agent) do
65
- 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36'
66
- end
67
-
68
- describe '#os_family' do
69
- it 'returns the operating system name' do
70
- value(client.os_family).must_equal 'GNU/Linux'
71
- end
72
- end
73
-
74
- describe '#os_name' do
75
- it 'returns the operating system name' do
76
- value(client.os_name).must_equal 'Ubuntu'
77
- end
78
- end
79
- end
80
-
81
- describe 'firefox mobile phone' do
82
- let(:user_agent) { 'Mozilla/5.0 (Android 7.0; Mobile; rv:53.0) Gecko/53.0 Firefox/53.0' }
83
-
84
- it 'detects smartphone' do
85
- value(client.device_type).must_equal 'smartphone'
86
- end
87
- end
88
-
89
- describe 'firefox mobile tablet' do
90
- let(:user_agent) { 'Mozilla/5.0 (Android 6.0.1; Tablet; rv:47.0) Gecko/47.0 Firefox/47.0' }
91
-
92
- it 'detects tablet' do
93
- value(client.device_type).must_equal 'tablet'
94
- end
95
- end
96
- end
97
-
98
- describe 'unknown user agent' do
99
- let(:user_agent) { 'garbage123' }
100
-
101
- describe '#name' do
102
- it 'returns nil' do
103
- value(client.name).must_be_nil
104
- end
105
- end
106
-
107
- describe '#full_version' do
108
- it 'returns nil' do
109
- value(client.full_version).must_be_nil
110
- end
111
- end
112
-
113
- describe '#os_name' do
114
- it 'returns nil' do
115
- value(client.os_name).must_be_nil
116
- end
117
- end
118
-
119
- describe '#os_full_version' do
120
- it 'returns nil' do
121
- value(client.os_full_version).must_be_nil
122
- end
123
- end
124
-
125
- describe '#known?' do
126
- it 'returns false' do
127
- value(client.known?).must_equal false
128
- end
129
- end
130
-
131
- describe '#bot?' do
132
- it 'returns false' do
133
- value(client.bot?).must_equal false
134
- end
135
- end
136
-
137
- describe '#bot_name' do
138
- it 'returns nil' do
139
- value(client.bot_name).must_be_nil
140
- end
141
- end
142
- end
143
-
144
- describe 'bot' do
145
- let(:user_agent) { 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' }
146
-
147
- describe '#name' do
148
- it 'returns nil' do
149
- value(client.name).must_be_nil
150
- end
151
- end
152
-
153
- describe '#full_version' do
154
- it 'returns nil' do
155
- value(client.full_version).must_be_nil
156
- end
157
- end
158
-
159
- describe '#os_name' do
160
- it 'returns nil' do
161
- value(client.os_name).must_be_nil
162
- end
163
- end
164
-
165
- describe '#os_full_version' do
166
- it 'returns nil' do
167
- value(client.os_full_version).must_be_nil
168
- end
169
- end
170
-
171
- describe '#known?' do
172
- it 'returns false' do
173
- value(client.known?).must_equal false
174
- end
175
- end
176
-
177
- describe '#bot?' do
178
- it 'returns true' do
179
- value(client.bot?).must_equal true
180
- end
181
- end
182
-
183
- describe '#bot_name' do
184
- it 'returns the name of the bot' do
185
- value(client.bot_name).must_equal 'Googlebot'
186
- end
187
- end
188
- end
189
- end