Class: UserAgent::Browsers::PodcastAddict

Inherits:
Base
  • Object
show all
Defined in:
lib/user_agent/browsers/podcast_addict.rb

Overview

Podcast Addict - Dalvik/1.6.0 (Linux; U; Android 4.4.2; LG-D631 Build/KOT49I.D63110b) Podcast Addict - Dalvik/2.1.0 (Linux; U; Android 5.1; XT1093 Build/LPE23.32-21.3) Podcast Addict - Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.2 Mobile Safari/534.30 Podcast Addict - Mozilla/5.0 (Linux; U; Android 4.2.2; en-ca; ALCATEL ONE TOUCH 6040A Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.2 Mobile Safari/534.30 Podcast Addict - Dalvik/2.1.0 (Linux; U; Android M Build/MPZ79M)

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#<=>, #application, #bot?, #eql?, #method_missing, #respond_to?, #to_h, #to_s, #to_str

Methods included from Comparable

#<, #<=, #==, #>, #>=

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class UserAgent::Browsers::Base

Class Method Details

.extend?(agent) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/user_agent/browsers/podcast_addict.rb', line 9

def self.extend?(agent)
  agent.length >= 3 && agent[0].product == 'Podcast' && agent[1].product == 'Addict' && agent[2].product == '-'
end

Instance Method Details

#browserObject



13
14
15
# File 'lib/user_agent/browsers/podcast_addict.rb', line 13

def browser
  'Podcast Addict'
end

#devicenil, String

If we can figure out the device, return it.

Returns:

  • (nil, String)

    the device model



20
21
22
23
24
25
# File 'lib/user_agent/browsers/podcast_addict.rb', line 20

def device
  return nil unless length >= 4
  return nil unless self[3].comment.last.include?(' Build/')

  self[3].comment.last.split(' Build/').first
end

#device_buildnil, String

If we can figure out the device build, return it.

Returns:

  • (nil, String)

    the device build



30
31
32
33
34
35
# File 'lib/user_agent/browsers/podcast_addict.rb', line 30

def device_build
  return nil unless length >= 4
  return nil unless self[3].comment.last.include?(' Build/')

  self[3].comment.last.split(' Build/').last
end

#localizationnil, String

Returns the localization, if known. We currently only know this for certain devices.

Returns:

  • (nil, String)

    the localization



40
41
42
43
44
45
46
# File 'lib/user_agent/browsers/podcast_addict.rb', line 40

def localization
  return nil unless length >= 4
  return nil unless self[3].comment.last.include?('ALCATEL ')
  return nil unless self[3].comment.length >= 5

  self[3].comment[3]
end

#mobile?true

This is a mobile app, always return true.

Returns:

  • (true)


51
52
53
# File 'lib/user_agent/browsers/podcast_addict.rb', line 51

def mobile?
  true
end

#osnil, String

Gets the operating system (some variant of Android, if we’re certain that is the case)

Returns:

  • (nil, String)

    the operating system



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/user_agent/browsers/podcast_addict.rb', line 58

def os
  return nil unless length >= 4

  # comment[0] = 'Linux'
  # comment[1] = 'U'
  # comment[2] = 'Android x.y.z' except when there are only 3 tokens, then we don't know the version
  if (self[3].product == 'Dalvik' || self[3].product == 'Mozilla') && self[3].comment.length > 3
    self[3].comment[2]
  elsif (self[3].product == 'Dalvik' || self[3].product == 'Mozilla') && self[3].comment.length == 3
    'Android'
  else
    nil
  end
end

#platformnil, "Android"

Gets the platform (Android, if we’re certain)

Returns:

  • (nil, "Android")

    the platform



76
77
78
79
80
81
82
# File 'lib/user_agent/browsers/podcast_addict.rb', line 76

def platform
  if os.include?('Android')
    'Android'
  else
    nil
  end
end

#security:weak, ...

Get the security level reported

Returns:

  • (:weak, :strong, :none)

    the security level



88
89
90
91
92
93
# File 'lib/user_agent/browsers/podcast_addict.rb', line 88

def security
  return nil unless length >= 4
  return nil unless self[3].product == 'Dalvik' || self[3].product == 'Mozilla'

  Security[self[3].comment[1]]
end

#versionnil

We aren’t provided with the version :(

Returns:

  • (nil)


98
99
100
# File 'lib/user_agent/browsers/podcast_addict.rb', line 98

def version
  nil
end