Class: Arcp::Session::Welcome

Inherits:
Data
  • Object
show all
Defined in:
lib/arcp/session/welcome.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#capabilitiesObject (readonly)

Returns the value of attribute capabilities

Returns:

  • (Object)

    the current value of capabilities



5
6
7
# File 'lib/arcp/session/welcome.rb', line 5

def capabilities
  @capabilities
end

#heartbeat_interval_secObject (readonly)

Returns the value of attribute heartbeat_interval_sec

Returns:

  • (Object)

    the current value of heartbeat_interval_sec



5
6
7
# File 'lib/arcp/session/welcome.rb', line 5

def heartbeat_interval_sec
  @heartbeat_interval_sec
end

#resume_tokenObject (readonly)

Returns the value of attribute resume_token

Returns:

  • (Object)

    the current value of resume_token



5
6
7
# File 'lib/arcp/session/welcome.rb', line 5

def resume_token
  @resume_token
end

#resume_window_secObject (readonly)

Returns the value of attribute resume_window_sec

Returns:

  • (Object)

    the current value of resume_window_sec



5
6
7
# File 'lib/arcp/session/welcome.rb', line 5

def resume_window_sec
  @resume_window_sec
end

#runtime_nameObject (readonly)

Returns the value of attribute runtime_name

Returns:

  • (Object)

    the current value of runtime_name



5
6
7
# File 'lib/arcp/session/welcome.rb', line 5

def runtime_name
  @runtime_name
end

#runtime_versionObject (readonly)

Returns the value of attribute runtime_version

Returns:

  • (Object)

    the current value of runtime_version



5
6
7
# File 'lib/arcp/session/welcome.rb', line 5

def runtime_version
  @runtime_version
end

Class Method Details

.from_h(h) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/arcp/session/welcome.rb', line 9

def self.from_h(h)
  h = h.transform_keys(&:to_s)
  caps = h['capabilities'] || {}
  new(
    runtime_name: h['runtime_name'],
    runtime_version: h['runtime_version'],
    capabilities: CapabilitySet.new(
      features: Array(caps['features']).freeze,
      encodings: Array(caps['encodings']).freeze,
      agents: caps['agents'] ? AgentInventory.from_array(caps['agents']) : nil
    ),
    heartbeat_interval_sec: h['heartbeat_interval_sec'],
    resume_token: h['resume_token'],
    resume_window_sec: h['resume_window_sec']
  )
end

Instance Method Details

#to_hObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/arcp/session/welcome.rb', line 26

def to_h
  {
    'runtime_name' => runtime_name,
    'runtime_version' => runtime_version,
    'capabilities' => capabilities.to_h,
    'heartbeat_interval_sec' => heartbeat_interval_sec,
    'resume_token' => resume_token,
    'resume_window_sec' => resume_window_sec
  }
end