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.



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

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.



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

def id
  @id
end

#methodObject (readonly)

Returns the value of attribute method.



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

def method
  @method
end

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

Instance Method Details

#[](key) ⇒ Object



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

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

#dialog?Boolean

Returns:

  • (Boolean)


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

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

#messageObject



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

def message = @raw["message"]

#notify_typeObject



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

def notify_type = @raw["notifyType"]

#optionsObject



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

def options = @raw["options"]

#placeholderObject



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

def placeholder = @raw["placeholder"]

#prefillObject



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

def prefill = @raw["prefill"]

#textObject



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

def text = @raw["text"]

#timeout_msObject



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

def timeout_ms = @raw["timeout"]

#titleObject



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

def title = @raw["title"]