Module: Lich::API

Defined in:
documented/api/active_sessions.rb

Class Method Summary collapse

Class Method Details

.active_session_service_infoHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Provides information about the active session service availability.

Returns:

  • (Hash)

    a hash containing source and service availability status.



32
33
34
35
36
37
38
39
# File 'documented/api/active_sessions.rb', line 32

def self.active_session_service_info
  return {
    source: 'ActiveSessionsAPI',
    service_available: false
  } unless defined?(Lich::InternalAPI::ActiveSessions)

  Lich::InternalAPI::ActiveSessions.service_info
end

.active_session_snapshotHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a snapshot of the active sessions.

Returns:

  • (Hash)

    a hash containing session information including source, total, connected, detachable, and sessions.



8
9
10
11
12
13
14
15
16
17
18
# File 'documented/api/active_sessions.rb', line 8

def self.active_session_snapshot
  return {
    source: 'ActiveSessionsAPI',
    total: 0,
    connected: 0,
    detachable: 0,
    sessions: []
  } unless defined?(Lich::InternalAPI::ActiveSessions)

  Lich::InternalAPI::ActiveSessions.snapshot
end

.active_sessionsArray<Hash>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Retrieves the list of active sessions.

Returns:

  • (Array<Hash>)

    an array of active session hashes.



24
25
26
# File 'documented/api/active_sessions.rb', line 24

def self.active_sessions
  active_session_snapshot[:sessions] || []
end