browserino 2.3.0 → 2.4.0
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/.gitignore +1 -0
- data/.travis.yml +2 -0
- data/CHANGELOG.md +8 -0
- data/README.md +94 -21
- data/lib/browserino/integrate/action_controller.rb +11 -0
- data/lib/browserino/integrate/rails.rb +12 -0
- data/lib/browserino/version.rb +1 -1
- data/lib/browserino.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b5620248b55bb700730a80e4d7276148081f686
|
4
|
+
data.tar.gz: 99d49e62bed9ddecd80d47e0ba16cf929b85624c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120db10d8fae325502dec215a8c2e960afac7bd4f37c663b53a1b13d9a4ecc3deed381c9fd23e3009cac333eb06d11f4ad677b1edc6f791afa9fb3b8c1176aca
|
7
|
+
data.tar.gz: c209b683298709e503ce623a5d4e02010a333c95befbf49f5ae2152185557e50abd4d9e877327ffa7ac32f0aa29d1245408b1bc09545878c80f442fed7b5a534
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
## CHANGELOG
|
2
2
|
_dates are in dd-mm-yyyy format_
|
3
3
|
|
4
|
+
#### 04-01-2016 VERSION 2.1.0
|
5
|
+
|
6
|
+
- Small restructuring of test suite
|
7
|
+
- Added bot detection
|
8
|
+
- Added `#bot?` method
|
9
|
+
- Added dynamic method support for bots
|
10
|
+
- Added support for the seamonkey browser
|
11
|
+
|
4
12
|
#### 03-01-2016 VERSION 2.0.0
|
5
13
|
|
6
14
|
- **IMPORTANT** Changed behaviour of all dynamic methods to include version as an argument rather than in the method name.
|
data/README.md
CHANGED
@@ -10,6 +10,10 @@ This gem aims to provide information about the browser that your visitor is usin
|
|
10
10
|
_dates are in dd-mm-yyyy format_
|
11
11
|
_older changes can be found in the [CHANGELOG.md](https://github.com/SidOfc/browserino/blob/master/CHANGELOG.md)_
|
12
12
|
|
13
|
+
#### 10-01-2016 VERSION 2.4.0
|
14
|
+
|
15
|
+
- Added rails integration
|
16
|
+
|
13
17
|
#### 06-01-2016 VERSION 2.3.0
|
14
18
|
|
15
19
|
- Added `#compat?` method to test if IE is in compatibility mode
|
@@ -22,14 +26,6 @@ _older changes can be found in the [CHANGELOG.md](https://github.com/SidOfc/brow
|
|
22
26
|
- Added more bots
|
23
27
|
- `#bot?` method can now take a bot name as argument to check for an exact bot
|
24
28
|
|
25
|
-
#### 04-01-2016 VERSION 2.1.0
|
26
|
-
|
27
|
-
- Small restructuring of test suite
|
28
|
-
- Added bot detection
|
29
|
-
- Added `#bot?` method
|
30
|
-
- Added dynamic method support for bots
|
31
|
-
- Added support for the seamonkey browser
|
32
|
-
|
33
29
|
## Installation
|
34
30
|
|
35
31
|
*supports ruby 1.9.3+*
|
@@ -60,14 +56,18 @@ Afterwards you can simply call
|
|
60
56
|
```ruby
|
61
57
|
Browserino::parse('<user agent>')
|
62
58
|
```
|
63
|
-
|
64
|
-
|
59
|
+
|
60
|
+
Or if you're using Rails *(>= 3.2.0)*, in your controllers you'll have access to an `agent` object
|
65
61
|
|
66
62
|
```ruby
|
67
|
-
|
63
|
+
class HomeController < ApplicationController
|
64
|
+
def index
|
65
|
+
render json: agent
|
66
|
+
end
|
67
|
+
end
|
68
68
|
```
|
69
69
|
|
70
|
-
|
70
|
+
The return value will always be `nil` if a value isn't found
|
71
71
|
|
72
72
|
`Browserino::parse()` will return a `Browserino::Agent` object containing all the information parsed out of the supplied user agent.
|
73
73
|
On this object there are a few method calls you can do to retrieve information.
|
@@ -162,6 +162,7 @@ agent.to_a
|
|
162
162
|
# [:system_name, 'macintosh'],
|
163
163
|
# [:system_version, '10'],
|
164
164
|
# [:system_architecture, nil],
|
165
|
+
# [:locale, nil],
|
165
166
|
# [:bot_name, nil]
|
166
167
|
# ]
|
167
168
|
|
@@ -174,6 +175,7 @@ agent.to_h
|
|
174
175
|
# system_name: 'macintosh',
|
175
176
|
# system_version: '10',
|
176
177
|
# system_architecture: nil,
|
178
|
+
# locale: nil,
|
177
179
|
# bot_name: nil
|
178
180
|
# }
|
179
181
|
```
|
@@ -192,22 +194,32 @@ Browsers can also accept a float / integer to check for a specific version.
|
|
192
194
|
|
193
195
|
```ruby
|
194
196
|
agent.android?
|
197
|
+
|
195
198
|
# check for android jellybean
|
196
199
|
# agent.android?(:jellybean) or agent.android?('jellybean') or agent.android?(4.1)
|
200
|
+
|
197
201
|
agent.ios?
|
198
|
-
|
202
|
+
|
203
|
+
# check version of iOS (>= 1.0.0)
|
199
204
|
# agent.ios9?
|
200
|
-
|
205
|
+
|
206
|
+
# check version of iOS (>= 2.0.0)
|
201
207
|
# agent.ios?(9)
|
208
|
+
|
202
209
|
agent.windows?
|
203
|
-
|
210
|
+
|
211
|
+
# check for windows Vista (>= 1.0.0)
|
204
212
|
# agent.windows60?
|
205
|
-
|
213
|
+
|
214
|
+
# check for windows Vista (>= 2.0.0)
|
206
215
|
# agent.windows?(6) - based on NT version
|
207
216
|
# agent.windows?(6.0) - based on NT version
|
208
217
|
# agent.windows?(:vista) or agent.windows?('vista')
|
218
|
+
|
209
219
|
agent.macintosh?
|
220
|
+
|
210
221
|
agent.blackberry?
|
222
|
+
|
211
223
|
agent.linux?
|
212
224
|
```
|
213
225
|
|
@@ -215,22 +227,32 @@ You could also invert these questions by using the `.not` method
|
|
215
227
|
|
216
228
|
```ruby
|
217
229
|
agent.not.android?
|
230
|
+
|
218
231
|
# check for android jellybean
|
219
232
|
# agent.not.android?(:jelly_bean) or agent.not.android?('jelly bean') or agent.not.android?(4.1)
|
233
|
+
|
220
234
|
agent.not.ios?
|
221
|
-
|
235
|
+
|
236
|
+
# check if iOS version isn't 9 (>= 1.4.0)
|
222
237
|
# agent.not.ios9?
|
223
|
-
|
238
|
+
|
239
|
+
# check if iOS version isn't 9 (>= 2.0.0)
|
224
240
|
# agent.not.ios?(9)
|
241
|
+
|
225
242
|
agent.not.windows?
|
226
|
-
|
243
|
+
|
244
|
+
# check if not windows vista (>= 1.4.0)
|
227
245
|
# agent.not.windows60?
|
246
|
+
|
228
247
|
# check if not windows vista (v2.x.x)
|
229
248
|
# agent.not.windows?(6) - based on NT version
|
230
249
|
# agent.not.windows?(6.0) - based on NT version
|
231
250
|
# agent.not.windows?(:vista) or agent.not.windows?('vista')
|
251
|
+
|
232
252
|
agent.not.macintosh?
|
253
|
+
|
233
254
|
agent.not.blackberry?
|
255
|
+
|
234
256
|
agent.not.linux?
|
235
257
|
```
|
236
258
|
|
@@ -240,40 +262,62 @@ The `#windows?`, `#macintosh?` and `#blackberry?` each have a shortcut method to
|
|
240
262
|
|
241
263
|
```ruby
|
242
264
|
agent.opera?
|
265
|
+
|
243
266
|
agent.opera_mini?
|
267
|
+
|
244
268
|
agent.bolt?
|
269
|
+
|
245
270
|
agent.ucbrowser?
|
271
|
+
|
246
272
|
agent.maxthon?
|
273
|
+
|
247
274
|
agent.edge?
|
275
|
+
|
248
276
|
agent.ie?
|
277
|
+
|
249
278
|
agent.firefox?
|
279
|
+
|
250
280
|
agent.chrome?
|
281
|
+
|
251
282
|
agent.seamonkey?
|
283
|
+
|
252
284
|
agent.safari?
|
253
285
|
|
254
|
-
# or with the .not method (
|
286
|
+
# or with the .not method (>= 1.4.0)
|
255
287
|
|
256
288
|
agent.not.opera?
|
289
|
+
|
257
290
|
agent.not.maxthon?
|
291
|
+
|
258
292
|
# etc etc...
|
259
293
|
```
|
260
294
|
|
261
295
|
##### Supported bots
|
262
296
|
```ruby
|
263
297
|
agent.msnbot?
|
298
|
+
|
264
299
|
agent.yahoo_slurp?
|
300
|
+
|
265
301
|
agent.googlebot?
|
302
|
+
|
266
303
|
agent.bingbot?
|
304
|
+
|
267
305
|
agent.baiduspider?
|
306
|
+
|
268
307
|
agent.yandexbot?
|
308
|
+
|
269
309
|
agent.sosospider?
|
310
|
+
|
270
311
|
agent.exabot?
|
312
|
+
|
271
313
|
agent.sogou_spider?
|
272
314
|
|
273
|
-
# or with the .not method (v1.4.0
|
315
|
+
# or with the .not method (>= v1.4.0)
|
274
316
|
|
275
317
|
agent.not.msnbot?
|
318
|
+
|
276
319
|
agent.not.yahoo_slurp?
|
320
|
+
|
277
321
|
# etc etc...
|
278
322
|
```
|
279
323
|
|
@@ -299,6 +343,7 @@ module UserAgents
|
|
299
343
|
system_name: ['windows', '7'],
|
300
344
|
system_version: '6.1',
|
301
345
|
system_architecture: 'x64',
|
346
|
+
locale: nil,
|
302
347
|
x64?: true,
|
303
348
|
x32?: false,
|
304
349
|
known?: true,
|
@@ -315,33 +360,52 @@ Valid browser names are defined by __/lib/browserino/patterns.rb__ (the keys are
|
|
315
360
|
#### browser_name examples
|
316
361
|
```ruby
|
317
362
|
'ie'
|
363
|
+
|
318
364
|
'firefox'
|
365
|
+
|
319
366
|
'chrome'
|
367
|
+
|
320
368
|
'opera'
|
369
|
+
|
321
370
|
'opera_mini'
|
371
|
+
|
322
372
|
'bolt'
|
373
|
+
|
323
374
|
'ucbrowser'
|
375
|
+
|
324
376
|
'seamonkey'
|
377
|
+
|
325
378
|
'maxthon'
|
326
379
|
```
|
327
380
|
|
328
381
|
#### engine_name examples
|
329
382
|
```ruby
|
383
|
+
|
330
384
|
'gecko'
|
385
|
+
|
331
386
|
'webkit'
|
387
|
+
|
332
388
|
'trident'
|
333
389
|
```
|
334
390
|
|
335
391
|
#### bot_name examples
|
336
392
|
```ruby
|
337
393
|
'googlebot'
|
394
|
+
|
338
395
|
'yahoo_slurp'
|
396
|
+
|
339
397
|
'msnbot'
|
398
|
+
|
340
399
|
'bingbot'
|
400
|
+
|
341
401
|
'baiduspider'
|
402
|
+
|
342
403
|
'yandexbot'
|
404
|
+
|
343
405
|
'sosospider'
|
406
|
+
|
344
407
|
'exabot'
|
408
|
+
|
345
409
|
'sogou_spider'
|
346
410
|
```
|
347
411
|
|
@@ -349,19 +413,28 @@ Valid browser names are defined by __/lib/browserino/patterns.rb__ (the keys are
|
|
349
413
|
|
350
414
|
```ruby
|
351
415
|
'windows'
|
416
|
+
|
352
417
|
'win'
|
418
|
+
|
353
419
|
'macintosh'
|
420
|
+
|
354
421
|
'osx'
|
422
|
+
|
355
423
|
'blackberry'
|
424
|
+
|
356
425
|
'bb'
|
426
|
+
|
357
427
|
'android'
|
428
|
+
|
358
429
|
'ios'
|
430
|
+
|
359
431
|
'linux' # => doesn't have versions
|
360
432
|
```
|
361
433
|
|
362
434
|
#### system_architecture examples
|
363
435
|
```ruby
|
364
436
|
'x32'
|
437
|
+
|
365
438
|
'x64'
|
366
439
|
```
|
367
440
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails/railtie'
|
2
|
+
require_relative 'action_controller'
|
3
|
+
|
4
|
+
module Browserino
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
initializer 'browserino.init_on_action_controller' do
|
7
|
+
ActiveSupport.on_load :action_controller do
|
8
|
+
include Browserino::ActionController::Base
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/browserino/version.rb
CHANGED
data/lib/browserino.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browserino
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidney Liebrand
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -134,6 +134,8 @@ files:
|
|
134
134
|
- lib/browserino/alias.rb
|
135
135
|
- lib/browserino/browser.rb
|
136
136
|
- lib/browserino/engine.rb
|
137
|
+
- lib/browserino/integrate/action_controller.rb
|
138
|
+
- lib/browserino/integrate/rails.rb
|
137
139
|
- lib/browserino/maps/android.rb
|
138
140
|
- lib/browserino/maps/blackberry.rb
|
139
141
|
- lib/browserino/maps/ios.rb
|