Class: Identikey::Administration::SessionQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/identikey/administration/session_query.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(idx:, username:, domain:, location:, start_time:) ⇒ SessionQuery

Returns a new instance of SessionQuery.



25
26
27
28
29
30
31
# File 'lib/identikey/administration/session_query.rb', line 25

def initialize(idx:, username:, domain:, location:, start_time:)
  @idx        = idx
  @username   = username
  @domain     = domain
  @location   = location
  @start_time = start_time
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



23
24
25
# File 'lib/identikey/administration/session_query.rb', line 23

def domain
  @domain
end

#idxObject (readonly)

Returns the value of attribute idx.



23
24
25
# File 'lib/identikey/administration/session_query.rb', line 23

def idx
  @idx
end

#locationObject (readonly)

Returns the value of attribute location.



23
24
25
# File 'lib/identikey/administration/session_query.rb', line 23

def location
  @location
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



23
24
25
# File 'lib/identikey/administration/session_query.rb', line 23

def start_time
  @start_time
end

#usernameObject (readonly)

Returns the value of attribute username.



23
24
25
# File 'lib/identikey/administration/session_query.rb', line 23

def username
  @username
end

Class Method Details

.all(session:) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/identikey/administration/session_query.rb', line 5

def self.all(session:)
  stat, sessions, error = session.execute(:admin_session_query)

  if stat != 'STAT_SUCCESS'
    raise Identikey::OperationFailed, "query failed: #{stat} - #{error}"
  end

  sessions.map do |sess|
    new(
      idx:        sess['ADMINSESSIONFLD_SESSION_IDX'],
      username:   sess['ADMINSESSIONFLD_LOGIN_NAME'],
      domain:     sess['ADMINSESSIONFLD_DOMAIN'],
      location:   sess['ADMINSESSIONFLD_LOCATION'],
      start_time: sess['ADMINSESSIONFLD_START_TIME']
    )
  end
end