Module: Woothee::MobilePhone

Extended by:
Util
Defined in:
lib/woothee/mobilephone.rb

Class Method Summary collapse

Methods included from Util

update_category, update_map, update_os, update_os_version, update_version

Class Method Details

.challenge_au(ua, result) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/woothee/mobilephone.rb', line 24

def self.challenge_au(ua, result)
  return false if ua.index('KDDI-').nil?

  # fix Woothee::OS.challenge_mobile if you want to fix here
  version = if ua =~ /KDDI-([^- \/;()"']+)/o
              $1
            else
              Woothee::VALUE_UNKNOWN
            end
  update_map(result, Woothee::DataSet.get('au'))
  update_version(result, version)
  true
end

.challenge_docomo(ua, result) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/woothee/mobilephone.rb', line 9

def self.challenge_docomo(ua, result)
  return false if ua.index('DoCoMo').nil? and ua.index(';FOMA;').nil?

  version = if ua =~ /DoCoMo\/[.0-9]+[ \/]([^- \/;()"']+)/o
              $1
            elsif ua =~ /\(([^;)]+);FOMA;/o
              $1
            else
              Woothee::VALUE_UNKNOWN
            end
  update_map(result, Woothee::DataSet.get('docomo'))
  update_version(result, version)
  true
end

.challenge_misc(ua, result) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/woothee/mobilephone.rb', line 65

def self.challenge_misc(ua, result)
  if ua.index('jig browser')
    update_map(result, Woothee::DataSet.get('jig'))
    if ua =~ /jig browser[^;]+; ([^);]+)/o
      update_version(result, $1)
    end
    return true
  end
  if ua.index('emobile/') or ua.index('OpenBrowser') or ua.index('Browser/Obigo-Browser')
    update_map(result, Woothee::DataSet.get('emobile'))
    return true
  end
  if ua.index('SymbianOS')
    update_map(result, Woothee::DataSet.get('SymbianOS'))
    return true
  end
  if ua.index('Hatena-Mobile-Gateway/')
    update_map(result, Woothee::DataSet.get('MobileTranscoder'))
    update_version(result, 'Hatena')
    return true
  end
  if ua.index('livedoor-Mobile-Gateway/')
    update_map(result, Woothee::DataSet.get('MobileTranscoder'))
    update_version(result, 'livedoor')
    return true
  end

  false
end

.challenge_softbank(ua, result) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/woothee/mobilephone.rb', line 38

def self.challenge_softbank(ua, result)
  return false if ua.index('SoftBank').nil? and ua.index('Vodafone').nil? and ua.index('J-PHONE').nil?

  version = if ua =~ /(?:SoftBank|Vodafone|J-PHONE)\/[.0-9]+\/([^ \/;()]+)/o
              $1
            else
              Woothee::VALUE_UNKNOWN
            end
  update_map(result, Woothee::DataSet.get('SoftBank'))
  update_version(result, version)
  true
end

.challenge_willcom(ua, result) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/woothee/mobilephone.rb', line 51

def self.challenge_willcom(ua, result)
  return false if ua.index('WILLCOM').nil? and ua.index('DDIPOCKET').nil?

  # fix Woothee::OS.challenge_mobile if you want to fix here
  version = if ua =~ /(?:WILLCOM|DDIPOCKET);[^\/]+\/([^ \/;()]+)/o
              $1
            else
              Woothee::VALUE_UNKNOWN
            end
  update_map(result, Woothee::DataSet.get('willcom'))
  update_version(result, version)
  true
end