Class: PiAgent::ExtensionUI::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/pi_agent/extension_ui.rb

Overview

One extension UI request. Wraps the raw protocol message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Request

Returns a new instance of Request.



30
31
32
33
34
# File 'lib/pi_agent/extension_ui.rb', line 30

def initialize(raw)
  @raw = raw
  @id = raw["id"]
  @method = raw["method"]&.to_sym
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



28
29
30
# File 'lib/pi_agent/extension_ui.rb', line 28

def id
  @id
end

#methodObject (readonly)

Returns the value of attribute method.



28
29
30
# File 'lib/pi_agent/extension_ui.rb', line 28

def method
  @method
end

#rawObject (readonly)

Returns the value of attribute raw.



28
29
30
# File 'lib/pi_agent/extension_ui.rb', line 28

def raw
  @raw
end

Instance Method Details

#[](key) ⇒ Object



49
50
51
# File 'lib/pi_agent/extension_ui.rb', line 49

def [](key)
  @raw[key.to_s]
end

#dialog?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/pi_agent/extension_ui.rb', line 36

def dialog?
  DIALOG_METHODS.include?(@method)
end

#messageObject



41
# File 'lib/pi_agent/extension_ui.rb', line 41

def message = @raw["message"]

#notify_typeObject



46
# File 'lib/pi_agent/extension_ui.rb', line 46

def notify_type = @raw["notifyType"]

#optionsObject



42
# File 'lib/pi_agent/extension_ui.rb', line 42

def options = @raw["options"]

#placeholderObject



43
# File 'lib/pi_agent/extension_ui.rb', line 43

def placeholder = @raw["placeholder"]

#prefillObject



44
# File 'lib/pi_agent/extension_ui.rb', line 44

def prefill = @raw["prefill"]

#textObject



47
# File 'lib/pi_agent/extension_ui.rb', line 47

def text = @raw["text"]

#timeout_msObject



45
# File 'lib/pi_agent/extension_ui.rb', line 45

def timeout_ms = @raw["timeout"]

#titleObject



40
# File 'lib/pi_agent/extension_ui.rb', line 40

def title = @raw["title"]