Class: SimpleAcp::Models::MessageAwaitResume

Inherits:
AwaitResume show all
Defined in:
lib/simple_acp/models/await.rb

Overview

Resume payload containing a message response.

Used to provide text or other message input to an awaiting run.

Instance Attribute Summary collapse

Attributes inherited from AwaitResume

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, attribute, attributes, #hash, own_attributes, #to_h, #to_json

Constructor Details

#initialize(**kwargs) ⇒ MessageAwaitResume

Returns a new instance of MessageAwaitResume.



101
102
103
104
# File 'lib/simple_acp/models/await.rb', line 101

def initialize(**kwargs)
  kwargs[:type] = "message"
  super
end

Instance Attribute Details

#message ⇒ Message? (readonly)

Returns the client's response message.

Returns:

  • (Message, nil) —

    the client's response message



99
# File 'lib/simple_acp/models/await.rb', line 99

attribute :message

Class Method Details

.from_hash(hash) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/simple_acp/models/await.rb', line 106

def self.from_hash(hash)
  return nil if hash.nil?

  instance = allocate
  instance.instance_variable_set(:@type, "message")

  if hash["message"] || hash[:message]
    instance.instance_variable_set(
      :@message,
      Message.from_hash(hash["message"] || hash[:message])
    )
  end

  instance
end