wurfl_device 0.1.2 → 0.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.
data/LICENSE CHANGED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Allan Ralph Hutalla <ahutalla@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -0,0 +1,3 @@
1
+ # WurflDevice
2
+ Ruby client library for mobile handset detection
3
+
@@ -131,7 +131,9 @@ module WurflDevice
131
131
  next if actual_device.nil?
132
132
  user_agent = actual_device.user_agent
133
133
  next if user_agent.nil? || user_agent.empty?
134
- db.hset(Constants::WURFL_USER_AGENTS, user_agent, Marshal::dump(Device.new(device_id)))
134
+ device = Device.new(device_id)
135
+ next unless device.is_valid?
136
+ db.hset(Constants::WURFL_USER_AGENTS, user_agent, Marshal::dump(device))
135
137
 
136
138
  next if user_agent =~ /^DO_NOT_MATCH/i
137
139
  matcher = UserAgentMatcher.new.get_index(user_agent)
@@ -42,8 +42,8 @@ module WurflDevice
42
42
  def list
43
43
  WurflDevice.get_user_agents_in_cache.each do |user_agent|
44
44
  device = WurflDevice.get_device_from_ua_cache(user_agent)
45
- device_id = ''
46
- device_id = device.id unless device.nil?
45
+ device_id = device.id || ''
46
+ user_agent ||= ''
47
47
  WurflDevice.ui.info user_agent + ":" + device_id
48
48
  end
49
49
  end
@@ -36,7 +36,7 @@ module WurflDevice
36
36
  last_attempts(@user_agent)
37
37
  end
38
38
 
39
- WurflDevice.save_device_in_ua_cache(@user_agent, @device)
39
+ WurflDevice.save_device_in_ua_cache(@user_agent, @device) if @device.is_valid?
40
40
 
41
41
  return self
42
42
  end
@@ -143,56 +143,56 @@ module WurflDevice
143
143
  protected
144
144
  # user agent matchers
145
145
  def last_attempts(user_agent)
146
- device_id = case
146
+ device_ua = case
147
147
  # OpenWave
148
148
  when user_agent.contains('UP.Browser/7.2')
149
- 'opwv_v72_generic'
149
+ 'DO_NOT_MATCH_UP.Browser/7.2'
150
150
  when user_agent.contains('UP.Browser/7')
151
- 'opwv_v7_generic'
151
+ 'DO_NOT_MATCH_UP.Browser/7'
152
152
  when user_agent.contains('UP.Browser/6.2')
153
- 'opwv_v62_generic'
153
+ 'DO_NOT_MATCH_UP.Browser/6.2'
154
154
  when user_agent.contains('UP.Browser/6')
155
- 'opwv_v6_generic'
155
+ 'DO_NOT_MATCH_UP.Browser/6'
156
156
  when user_agent.contains('UP.Browser/5')
157
- 'upgui_generic'
157
+ 'UP.Browser/5'
158
158
  when user_agent.contains('UP.Browser/4')
159
- 'uptext_generic'
159
+ 'DO_NOT_MATCH_UP.Browser/4'
160
160
  when user_agent.contains('UP.Browser/3')
161
- 'uptext_generic'
161
+ 'DO_NOT_MATCH_UP.Browser/4'
162
162
  # Series 60
163
163
  when user_agent.contains('Series60')
164
- 'nokia_generic_series60'
164
+ 'DO_NOT_MATCH_NOKIA_SERIES60'
165
165
  when user_agent.contains('Series80')
166
- 'nokia_generic_series80'
166
+ 'DO_NOT_MATCH_NOKIA_SERIES80'
167
167
  # Access/Net Front
168
168
  when user_agent.contains(['NetFront/3.0', 'ACS-NF/3.0'])
169
- 'generic_netfront_ver3'
169
+ 'DO_NOT_MATCH_NETFRONT_3'
170
170
  when user_agent.contains(['NetFront/3.1', 'ACS-NF/3.1'])
171
- 'generic_netfront_ver3_1'
171
+ 'DO_NOT_MATCH_NETFRONT_3_1'
172
172
  when user_agent.contains(['NetFront/3.2', 'ACS-NF/3.2'])
173
- 'generic_netfront_ver3_2'
173
+ 'DO_NOT_MATCH_NETFRONT_3_2'
174
174
  when user_agent.contains(['NetFront/3.3', 'ACS-NF/3.3'])
175
- 'generic_netfront_ver3_3'
175
+ 'DO_NOT_MATCH_NETFRONT_3_3'
176
176
  when user_agent.contains('NetFront/3.4')
177
- 'generic_netfront_ver3_4'
177
+ 'DO_NOT_MATCH_NETFRONT_3_5'
178
178
  when user_agent.contains('NetFront/3.5')
179
- 'generic_netfront_ver3_5'
179
+ 'DO_NOT_MATCH_NETFRONT_3_5'
180
180
  # Contains Mozilla/, but not at the beginning of the UA
181
- when user_agent.starts_with('Mozilla/') || @user_agent.contains('Mozilla/')
182
- WurflDevice::Constants::GENERIC_XHTML
181
+ when user_agent.starts_with('Mozilla/') || user_agent.contains('Mozilla/')
182
+ 'DO_NOT_MATCH_MOZILLA'
183
183
  # Obigo
184
184
  when user_agent.contains(['ObigoInternetBrowser/Q03C', 'AU-MIC/2', 'AU-MIC-', 'AU-OBIGO', 'Obigo/Q03', 'Obigo/Q04', 'ObigoInternetBrowser/2', 'Teleca Q03B1'])
185
- WurflDevice::Constants::GENERIC_XHTML
185
+ 'DO_NOT_MATCH_MOZILLA'
186
186
  # DoCoMo
187
- when user_agent.starts_with('DoCoMo') || @user_agent.starts_with('KDDI')
188
- 'docomo_generic_jap_ver1'
187
+ when user_agent.starts_with('DoCoMo') || user_agent.starts_with('KDDI')
188
+ 'DO_NOT_MATCH_DOCOMO_GENERIC_JAP_1'
189
189
  # Generic Mozilla
190
190
  when user_agent.contains(['Mozilla/4.0', 'Mozilla/5.0', 'Mozilla/6.0'])
191
- WurflDevice::Constants::GENERIC_WEB_BROWSER
191
+ 'DO_NOT_MATCH_GENERIC_WEB_BROWSER'
192
192
  else
193
193
  WurflDevice::Constants::GENERIC
194
194
  end
195
- @device = WurflDevice.get_device_from_id(device_id)
195
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
196
196
  end
197
197
 
198
198
  # mobile user agents
@@ -231,26 +231,26 @@ module WurflDevice
231
231
  end
232
232
  @device = ris_match(user_agent, tolerance)
233
233
  if @device.nil?
234
- if user_agent =~ /\#Black[Bb]erry[^\/\s]+\/(\d.\d)\#/
234
+ if user_agent =~ /Black[Bb]erry[^\/\s]+\/(\d\.\d)/
235
235
  versions = {
236
- '2.' => 'blackberry_generic_ver2',
237
- '3.2' => 'blackberry_generic_ver3_sub2',
238
- '3.3' => 'blackberry_generic_ver3_sub30',
239
- '3.5' => 'blackberry_generic_ver3_sub50',
240
- '3.6' => 'blackberry_generic_ver3_sub60',
241
- '3.7' => 'blackberry_generic_ver3_sub70',
242
- '4.1' => 'blackberry_generic_ver4_sub10',
243
- '4.2' => 'blackberry_generic_ver4_sub20',
244
- '4.3' => 'blackberry_generic_ver4_sub30',
245
- '4.5' => 'blackberry_generic_ver4_sub50',
246
- '4.6' => 'blackberry_generic_ver4_sub60',
247
- '4.7' => 'blackberry_generic_ver4_sub70',
248
- '4.' => 'blackberry_generic_ver4',
249
- '5.' => 'blackberry_generic_ver5',
250
- '6.' => 'blackberry_generic_ver6',
251
- }.each_pair do |version, device_id|
252
- if version.index($1)
253
- @device = Device.new(device_id)
236
+ '2.' => 'DO_NOT_MATCH_BLACKBERRY_2',
237
+ '3.2' => 'DO_NOT_MATCH_BLACKBERRY_3_2',
238
+ '3.3' => 'DO_NOT_MATCH_BLACKBERRY_3_3',
239
+ '3.5' => 'DO_NOT_MATCH_BLACKBERRY_3_5',
240
+ '3.6' => 'DO_NOT_MATCH_BLACKBERRY_3_6',
241
+ '3.7' => 'DO_NOT_MATCH_BLACKBERRY_3_7',
242
+ '4.1' => 'DO_NOT_MATCH_BLACKBERRY_4_1',
243
+ '4.2' => 'DO_NOT_MATCH_BLACKBERRY_4_2',
244
+ '4.3' => 'DO_NOT_MATCH_BLACKBERRY_4_3',
245
+ '4.5' => 'DO_NOT_MATCH_BLACKBERRY_4_5',
246
+ '4.6' => 'DO_NOT_MATCH_BLACKBERRY_4_6',
247
+ '4.7' => 'DO_NOT_MATCH_BLACKBERRY_4_7',
248
+ '4.' => 'DO_NOT_MATCH_BLACKBERRY_4',
249
+ '5.' => 'DO_NOT_MATCH_BLACKBERRY_5',
250
+ '6.' => 'DO_NOT_MATCH_BLACKBERRY_6',
251
+ }.each_pair do |vercode, device_ua|
252
+ if $1.index(vercode)
253
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
254
254
  break
255
255
  end
256
256
  end
@@ -280,7 +280,7 @@ module WurflDevice
280
280
  @device = ld_match(user_agent, tolerance)
281
281
  end
282
282
  if @device.nil?
283
- @device = Device.new('mot_mib22_generic') if @user_agent.contains('MIB/2.2') || @user_agent.contains('MIB/BER2.2')
283
+ @device = WurflDevice.get_device_from_ua_cache('DO_NOT_MATCH_MIB_2_2', true) if user_agent.contains('MIB/2.2') || user_agent.contains('MIB/BER2.2')
284
284
  end
285
285
  end
286
286
 
@@ -299,17 +299,17 @@ module WurflDevice
299
299
  end
300
300
  @device = ris_match(user_agent, tolerance)
301
301
  if @device.nil?
302
- device_id = case
302
+ device_ua = case
303
303
  when user_agent.contains('iPod')
304
- 'apple_ipod_touch_ver1'
304
+ 'Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3'
305
305
  when user_agent.contains('iPad')
306
- 'apple_ipad_ver1'
306
+ 'Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7D11'
307
307
  when user_agent.contains('iPhone')
308
- 'apple_iphone_ver1'
308
+ 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A538a Safari/419.3'
309
309
  else
310
310
  WurfDevice::Contants::GENERIC
311
311
  end
312
- @device = Device.new(device_id)
312
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
313
313
  end
314
314
  end
315
315
 
@@ -328,13 +328,13 @@ module WurflDevice
328
328
  @device = ris_match(user_agent, tolerance)
329
329
  if @device.nil?
330
330
  version_index = 7
331
- device_id = case
331
+ device_ua = case
332
332
  when user_agent[version_index] == '2'
333
- 'docomo_generic_jap_ver2'
333
+ 'DO_NOT_MATCH_DOCOMO_GENERIC_JAP_2'
334
334
  else
335
- 'docomo_generic_jap_ver1'
335
+ 'DO_NOT_MATCH_DOCOMO_GENERIC_JAP_1'
336
336
  end
337
- @device = Device.new(device_id)
337
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
338
338
  end
339
339
  end
340
340
 
@@ -361,7 +361,7 @@ module WurflDevice
361
361
  end
362
362
  @device = ris_match(user_agent, tolerance)
363
363
  if @device.nil?
364
- @device = Device.new('opwv_v62_generic')
364
+ @device = WurflDevice.get_device_from_ua_cache('DO_NOT_MATCH_UP.Browser/6.2', true)
365
365
  end
366
366
  end
367
367
 
@@ -396,17 +396,17 @@ module WurflDevice
396
396
  def matcher_nintendo(user_agent)
397
397
  @device = ld_match(user_agent, tolerance)
398
398
  if @device.nil?
399
- device_id = case
399
+ device_ua = case
400
400
  when user_agent.contains('Nintendo Wii')
401
- 'nintendo_wii_browser'
401
+ 'Opera/9.00 (Nintendo Wii; U; ; 1621; en)'
402
402
  when user_agent.contains('Nintendo DSi')
403
- 'nintendo_dsi_ver1'
403
+ 'Opera/9.50 (Nintendo DSi; Opera/483; U; en-US)'
404
404
  when user_agent.starts_with('Mozilla/') && user_agent.contains('Nitro') && user_agent.contains('Opera')
405
- 'nintendo_ds_ver1'
405
+ 'Mozilla/4.0 (compatible; MSIE 6.0; Nitro) Opera 8.50 [en]'
406
406
  else
407
- 'nintendo_wii_browser'
407
+ 'Opera/9.00 (Nintendo Wii; U; ; 1621; en)'
408
408
  end
409
- @device = Device.new(device_id)
409
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
410
410
  end
411
411
  end
412
412
 
@@ -430,7 +430,7 @@ module WurflDevice
430
430
  end
431
431
 
432
432
  def matcher_portalmmm(user_agent)
433
- @device = Device.new(WurflDevice::Constants::GENERIC)
433
+ @device = WurflDevice.get_device_from_ua_cache(WurflDevice::Constants::GENERIC, true)
434
434
  end
435
435
 
436
436
  def matcher_qtek(user_agent)
@@ -474,35 +474,35 @@ module WurflDevice
474
474
 
475
475
  # mobile browsers
476
476
  def matcher_android(user_agent)
477
- device_id = 'generic_android'
477
+ device_ua = 'DO_NOT_MATCH_GENERIC_ANDROID'
478
478
  if user_agent.contains('Froyo')
479
- device_id = Device.new('generic_android_ver2_2')
479
+ device_ua = 'DO_NOT_MATCH_ANDROID_2_2'
480
480
  elsif user_agent =~ /#Android[\s\/](\d).(\d)#/
481
481
  version = "generic_android_ver#{$1}_#{$2}"
482
482
  version = 'generic_android_ver2' if version == 'generic_android_ver2_0'
483
- device_id = version if [
484
- 'generic_android',
485
- 'generic_android_ver1_5',
486
- 'generic_android_ver1_6',
487
- 'generic_android_ver2',
488
- 'generic_android_ver2_1',
489
- 'generic_android_ver2_2',
490
- ].include?(version)
483
+ android_uas = {
484
+ 'generic_android_ver1_5' => 'DO_NOT_MATCH_ANDROID_1_5',
485
+ 'generic_android_ver1_6' => 'DO_NOT_MATCH_GENERIC_ANDROID_1_6',
486
+ 'generic_android_ver2' => 'DO_NOT_MATCH_GENERIC_ANDROID_2_0',
487
+ 'generic_android_ver2_1' => 'DO_NOT_MATCH_GENERIC_ANDROID_2_1',
488
+ 'generic_android_ver2_2' => 'DO_NOT_MATCH_ANDROID_2_2',
489
+ }
490
+ device_ua = android_uas[version] if android_uas.has_key?(version)
491
491
  end
492
- @device = Device.new(device_id)
492
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
493
493
  end
494
494
 
495
495
  def matcher_operamini(user_agent)
496
496
  tolerance = user_agent.first_slash
497
497
  @device = ris_match(user_agent, tolerance)
498
498
  if @device.nil?
499
- device_id = 'browser_opera_mini_release1';
499
+ device_ua = 'DO_NOT_MATCH_GENERIC_OPERA_MINI_VERSION_1';
500
500
  if user_agent =~ /#Opera Mini\/([1-5])#/
501
- device_id = "browser_opera_mini_release#{$1}"
501
+ device_ua = "DO_NOT_MATCH_BROWSER_OPERA_MINI_#{$1}_0"
502
502
  elsif user_agent.contains('Opera Mobi')
503
- device_id = 'browser_opera_mini_release4'
503
+ device_ua = 'DO_NOT_MATCH_GENERIC_OPERA_MINI_VERSION_4'
504
504
  end
505
- @device = Device.new(device_id)
505
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
506
506
  end
507
507
  end
508
508
 
@@ -510,7 +510,7 @@ module WurflDevice
510
510
  tolerance = 3
511
511
  @device = ld_match(user_agent, tolerance)
512
512
  if @device.nil?
513
- @device = Device.new('generic_ms_mobile_browser_ver1')
513
+ @device = WurflDevice.get_device_from_ua_cache('DO_NOT_MATCH_REMOVE_GENERIC_MS_MOBILE_BROWSER_VER1', true)
514
514
  end
515
515
  end
516
516
 
@@ -519,7 +519,7 @@ module WurflDevice
519
519
  tolerance = user_agent.first_slash
520
520
  @device = ris_match(user_agent, tolerance)
521
521
  if @device.nil?
522
- @device = Device.new(WurflDevice::Constants::GENERIC_WEB_BROWSER)
522
+ @device = WurflDevice.get_device_from_ua_cache('DO_NOT_MATCH_GENERIC_WEB_BROWSER', true)
523
523
  end
524
524
  end
525
525
 
@@ -528,21 +528,21 @@ module WurflDevice
528
528
  if user_agent =~ /^Mozilla\/4\.0 \(compatible; MSIE (\d)\.(\d);/
529
529
  version = $1.to_i
530
530
  version_sub = $2.to_i
531
- device_id = case
531
+ device_ua = case
532
532
  when version == 7
533
- 'msie_7'
533
+ 'Mozilla/4.0 (compatible; MSIE 7.0;'
534
534
  when version == 8
535
- 'msie_8'
535
+ 'Mozilla/4.0 (compatible; MSIE 8.0;'
536
536
  when version == 6
537
- 'msie_6'
537
+ 'Mozilla/4.0 (compatible; MSIE 6.0;'
538
538
  when version == 4
539
- 'msie_4'
539
+ 'Mozilla/4.0 (compatible; MSIE 4.0;'
540
540
  when version == 5
541
- version_sub == 5 ? 'msie_5_5' : 'msie_5'
541
+ version_sub == 5 ? 'Mozilla/4.0 (compatible; MSIE 5.5;' : 'Mozilla/4.0 (compatible; MSIE 5.0;'
542
542
  else
543
543
  'msie'
544
544
  end
545
- @device = Device.new(device_id)
545
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
546
546
  else
547
547
  user_agent.sub!(/( \.NET CLR [\d\.]+;?| Media Center PC [\d\.]+;?| OfficeLive[a-zA-Z0-9\.\d]+;?| InfoPath[\.\d]+;?)/, '')
548
548
  tolerance = user_agent.first_slash
@@ -550,9 +550,9 @@ module WurflDevice
550
550
  end
551
551
  if @device.nil?
552
552
  if user_agent.contains(['SLCC1', 'Media Center PC', '.NET CLR', 'OfficeLiveConnector'])
553
- @device = Device.new(WurfDevice::Constants::GENERIC_WEB_BROWSER)
553
+ @device = WurflDevice.get_device_from_ua_cache('DO_NOT_MATCH_GENERIC_WEB_BROWSER', true)
554
554
  else
555
- @device = Device.new(WurfDevice::Constants::GENERIC)
555
+ @device = WurflDevice.get_device_from_ua_cache(WurfDevice::Constants::GENERIC, true)
556
556
  end
557
557
  end
558
558
  end
@@ -561,17 +561,17 @@ module WurflDevice
561
561
  if user_agent =~ /Firefox\/(\d)\.(\d)/
562
562
  version = $1.to_i
563
563
  version_sub = $2.to_i
564
- device_id = case
564
+ device_ua = case
565
565
  when version == 3
566
- version_sub == 5 ? 'firefox_3_5' : 'firefox_3'
566
+ version_sub == 5 ? 'Firefox/3.5' : 'Firefox/3.0'
567
567
  when version == 2
568
568
  'firefox_2'
569
569
  when version == 1
570
- version_sub == 5 ? 'firefox_1_5' : 'firefox_1'
570
+ version_sub == 5 ? 'Firefox/1.5' : 'Firefox/1.0'
571
571
  else
572
572
  nil
573
573
  end
574
- @device = Device.new(device_id) unless device_id.nil?
574
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true) unless device_ua.nil?
575
575
  else
576
576
  tolerance = 5
577
577
  @device = ld_match(user_agent, tolerance)
@@ -582,7 +582,7 @@ module WurflDevice
582
582
  tolerance = user_agent.index_of_or_length('/', user_agent.index('Chrome'))
583
583
  @device = ris_match(user_agent, tolerance)
584
584
  if @device.nil?
585
- @device = Device.new('google_chrome')
585
+ @device = WurflDevice.get_device_from_ua_cache('Chrome', true)
586
586
  end
587
587
  end
588
588
 
@@ -592,42 +592,42 @@ module WurflDevice
592
592
  end
593
593
 
594
594
  def matcher_opera(user_agent)
595
- device_id = case
595
+ device_ua = case
596
596
  when user_agent.contains('Opera/10')
597
- 'opera_10'
597
+ 'Opera/10'
598
598
  when user_agent.contains('Opera/9')
599
- 'opera_9'
599
+ 'Opera/9'
600
600
  when user_agent.contains('Opera/8')
601
- 'opera_8'
601
+ 'Opera/8'
602
602
  when user_agent.contains('Opera/7')
603
- 'opera_7'
603
+ 'Opera/7'
604
604
  else
605
605
  nil
606
606
  end
607
- @device = Device.new(device_id) unless device_id.nil?
607
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true) unless device_ua.nil?
608
608
  if @device.nil?
609
609
  tolerance = 5
610
610
  @device = ld_match(user_agent, tolerance)
611
611
  end
612
- @device = Device.new('opera') if @device.nil?
612
+ @device = WurflDevice.get_device_from_ua_cache('Opera', true) if @device.nil?
613
613
  end
614
614
 
615
615
  def matcher_safari(user_agent)
616
616
  tolerance = user_agent.first_slash
617
617
  @device = ris_match(user_agent, tolerance)
618
618
  if @device.nil?
619
- device_id = case
619
+ device_ua = case
620
620
  when user_agent.contains('Macintosh') || user_agent.contains('Windows')
621
- WurflDevice::Constants::GENERIC_WEB_BROWSER
621
+ 'DO_NOT_MATCH_GENERIC_WEB_BROWSER'
622
622
  else
623
623
  WurflDevice::Constants::GENERIC
624
624
  end
625
- @device = Device.new(device_id)
625
+ @device = WurflDevice.get_device_from_ua_cache(device_ua, true)
626
626
  end
627
627
  end
628
628
 
629
629
  def matcher_aol(user_agent)
630
- @device = Device.new(WurflDevice::Constants::GENERIC_WEB_BROWSER)
630
+ @device = WurflDevice.get_device_from_ua_cache('DO_NOT_MATCH_GENERIC_WEB_BROWSER', true)
631
631
  end
632
632
  end
633
633
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module WurflDevice
4
- VERSION = "0.1.2".freeze
4
+ VERSION = "0.1.3".freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wurfl_device
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-06 00:00:00.000000000 Z
12
+ date: 2011-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &254521320 !ruby/object:Gem::Requirement
16
+ requirement: &34130760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *254521320
24
+ version_requirements: *34130760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &254520740 !ruby/object:Gem::Requirement
27
+ requirement: &34130320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *254520740
35
+ version_requirements: *34130320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: redis
38
- requirement: &254519960 !ruby/object:Gem::Requirement
38
+ requirement: &34129900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *254519960
46
+ version_requirements: *34129900
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: text
49
- requirement: &254519080 !ruby/object:Gem::Requirement
49
+ requirement: &34129480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *254519080
57
+ version_requirements: *34129480
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &254518340 !ruby/object:Gem::Requirement
60
+ requirement: &34128980 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.10
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *254518340
68
+ version_requirements: *34128980
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &254517820 !ruby/object:Gem::Requirement
71
+ requirement: &34128480 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.9.2
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *254517820
79
+ version_requirements: *34128480
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec-core
82
- requirement: &254517120 !ruby/object:Gem::Requirement
82
+ requirement: &34128020 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2.0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *254517120
90
+ version_requirements: *34128020
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rspec-expectations
93
- requirement: &254516080 !ruby/object:Gem::Requirement
93
+ requirement: &34127560 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '2.0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *254516080
101
+ version_requirements: *34127560
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rr
104
- requirement: &254515280 !ruby/object:Gem::Requirement
104
+ requirement: &34127100 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '1.0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *254515280
112
+ version_requirements: *34127100
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: faker
115
- requirement: &254493140 !ruby/object:Gem::Requirement
115
+ requirement: &34126640 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0.9'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *254493140
123
+ version_requirements: *34126640
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: simplecov
126
- requirement: &254492660 !ruby/object:Gem::Requirement
126
+ requirement: &34126180 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,7 +131,7 @@ dependencies:
131
131
  version: 0.5.3
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *254492660
134
+ version_requirements: *34126180
135
135
  description: Ruby client library for mobile handset detection
136
136
  email:
137
137
  - ahutalla@gmail.com
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
- rubygems_version: 1.8.6
184
+ rubygems_version: 1.8.10
185
185
  signing_key:
186
186
  specification_version: 3
187
187
  summary: Ruby client library for mobile handset detection