Class: Citrus::Common::Remote::Frontend::SessionRemote
- Inherits:
-
Object
- Object
- Citrus::Common::Remote::Frontend::SessionRemote
- Defined in:
- lib/citrus/common/remote/frontend/session_remote.rb
Overview
SessionRemote
Instance Method Summary collapse
-
#bind(sid, uid, &block) ⇒ Object
Bind the session with a user id.
-
#getBackendSessionBySid(sid, &block) ⇒ Object
Get session information with session id.
-
#getBackendSessionByUid(uid, &block) ⇒ Object
Get all the session information the specified user id.
-
#initialize(app) ⇒ SessionRemote
constructor
Create a new remote session service.
-
#kickBySid(sid, &block) ⇒ Object
Kick a session by session id.
-
#kickByUid(uid, &block) ⇒ Object
Kick sessions by user id.
-
#push(sid, key, value, &block) ⇒ Object
Push the key/value into session.
-
#pushAll(sid, settings, &block) ⇒ Object
Push new value for the existed session.
-
#unbind(sid, uid, &block) ⇒ Object
Unbind the session with a user id.
Constructor Details
#initialize(app) ⇒ SessionRemote
Create a new remote session service
25 26 27 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 25 def initialize app @app = app end |
Instance Method Details
#bind(sid, uid, &block) ⇒ Object
Bind the session with a user id
33 34 35 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 33 def bind sid, uid, &block @app.session_service.bind sid, uid, &block end |
#getBackendSessionBySid(sid, &block) ⇒ Object
Get session information with session id
65 66 67 68 69 70 71 72 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 65 def getBackendSessionBySid sid, &block session = @app.session_service.get sid unless session block_given? and yield return end block_given? and yield nil, session.to_frontend_session.export end |
#getBackendSessionByUid(uid, &block) ⇒ Object
Get all the session information the specified user id
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 77 def getBackendSessionByUid uid, &block sessions = @app.session_service.get_by_uid uid unless session block_given? and yield return end res = [] sessions.each { |session| res << session.to_frontend_session.export } block_given? and yield nil, res end |
#kickBySid(sid, &block) ⇒ Object
Kick a session by session id
94 95 96 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 94 def kickBySid sid, &block @app.session_service.kick_by_sid sid, &block end |
#kickByUid(uid, &block) ⇒ Object
Kick sessions by user id
101 102 103 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 101 def kickByUid uid, &block @app.session_service.kick uid, &block end |
#push(sid, key, value, &block) ⇒ Object
Push the key/value into session
50 51 52 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 50 def push sid, key, value, &block @app.session_service.import sid, key, value, &block end |
#pushAll(sid, settings, &block) ⇒ Object
Push new value for the existed session
58 59 60 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 58 def pushAll sid, settings, &block @app.session_service.import_all sid, settings, &block end |
#unbind(sid, uid, &block) ⇒ Object
Unbind the session with a user id
41 42 43 |
# File 'lib/citrus/common/remote/frontend/session_remote.rb', line 41 def unbind sid, uid, &block @app.session_service.unbind sid, uid, &block end |