class UserAgent::Browsers::ITunes

The user agent for iTunes

Some user agents: iTunes/10.6.1 (Macintosh; Intel Mac OS X 10.7.3) AppleWebKit/534.53.11 iTunes/12.0.1 (Macintosh; OS X 10.10) AppleWebKit/0600.1.25 iTunes/11.1.5 (Windows; Microsoft Windows 7 x64 Business Edition Service Pack 1 (Build 7601)) AppleWebKit/537.60.15 iTunes/12.0.1 (Windows; Microsoft Windows 8 x64 Home Premium Edition (Build 9200)) AppleWebKit/7600.1017.0.24 iTunes/12.0.1 (Macintosh; OS X 10.10.1) AppleWebKit/0600.1.25

Public Class Methods

extend?(agent) click to toggle source
# File lib/user_agent/browsers/itunes.rb, line 12
def self.extend?(agent)
  agent.detect { |useragent| useragent.product == "iTunes" }
end

Public Instance Methods

browser() click to toggle source

@return [“iTunes”] Always return iTunes as the browser

# File lib/user_agent/browsers/itunes.rb, line 17
def browser
  "iTunes"
end
build() click to toggle source

@return [nil, Version] The WebKit version in use if we have it

Calls superclass method
# File lib/user_agent/browsers/itunes.rb, line 32
def build
  super if webkit
end
full_os() click to toggle source

Parses the operating system in use.

@return [String] The operating system

# File lib/user_agent/browsers/itunes.rb, line 64
def full_os
  if application && application.comment && application.comment.length > 1
    full_os = application.comment[1]

    full_os = "#{full_os})" if full_os =~ /\(Build [0-9][0-9][0-9][0-9]\z/ # The regex chops the ) off :(

    full_os
  end
end
os() click to toggle source

Parses the operating system in use.

@return [String] The operating system

Calls superclass method
# File lib/user_agent/browsers/itunes.rb, line 39
def os
  full_os = self.full_os

  if application && application.comment[0] =~ /Windows/
    if full_os =~ /Windows 8\.1/
      "Windows 8.1"
    elsif full_os =~ /Windows 8/
      "Windows 8"
    elsif full_os =~ /Windows 7/
      "Windows 7"
    elsif full_os =~ /Windows Vista/
      "Windows Vista"
    elsif full_os =~ /Windows XP/
      "Windows XP"
    else
      "Windows"
    end
  else
    super
  end
end
security() click to toggle source

@return [nil] nil - not included in the user agent

# File lib/user_agent/browsers/itunes.rb, line 27
def security
  nil
end
version() click to toggle source

@return [Version] The version of iTunes in use

# File lib/user_agent/browsers/itunes.rb, line 22
def version
  self.iTunes.version
end