Class: Bnicovideo::UserSession

Inherits:
Object
  • Object
show all
Defined in:
lib/bnicovideo/user_session.rb,
lib/bnicovideo/user_session/linux.rb,
lib/bnicovideo/user_session/win95.rb,
lib/bnicovideo/user_session/win_xp.rb,
lib/bnicovideo/user_session/mac_os_x.rb,
lib/bnicovideo/user_session/win_vista.rb

Overview

User session class

Defined Under Namespace

Modules: Linux, MacOsX, Win95, WinVista, WinXp

Constant Summary collapse

OS_LIST =
{'winvista' => WinVista, 'winxp' => WinXp, 'win95' => Win95,
  'macosx' => MacOsX, 'unix' => Linux
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sid) ⇒ UserSession

Returns a new instance of UserSession.



22
23
24
# File 'lib/bnicovideo/user_session.rb', line 22

def initialize(sid)
  @session_id = sid
end

Instance Attribute Details

#session_idObject (readonly)

User session ID



21
22
23
# File 'lib/bnicovideo/user_session.rb', line 21

def session_id
  @session_id
end

Class Method Details

.init_from_chromeObject

Get user session from Google Chrome



35
36
37
38
39
40
41
42
# File 'lib/bnicovideo/user_session.rb', line 35

def self.init_from_chrome
  sess = OS_LIST[Bnicovideo::OsDetector.detect].init_from_chrome
  if sess
    return self.new(sess)
  else
    return nil
  end
end

.init_from_firefoxObject

Get user session from Firefox(3.0 or later)



26
27
28
29
30
31
32
33
# File 'lib/bnicovideo/user_session.rb', line 26

def self.init_from_firefox
  sess = OS_LIST[Bnicovideo::OsDetector.detect].init_from_firefox
  if sess
    return self.new(sess)
  else
    return nil
  end
end

.init_from_ieObject

Get user session from Internet Explorer



44
45
46
47
48
49
50
51
# File 'lib/bnicovideo/user_session.rb', line 44

def self.init_from_ie
  sess = OS_LIST[Bnicovideo::OsDetector.detect].init_from_ie
  if sess
    return self.new(sess)
  else
    return nil
  end
end

.init_from_safariObject

Get user session from Safari



53
54
55
56
57
58
59
60
# File 'lib/bnicovideo/user_session.rb', line 53

def self.init_from_safari
  sess = OS_LIST[Bnicovideo::OsDetector.detect].init_from_safari
  if sess
    return self.new(sess)
  else
    return nil
  end
end