Class: A2A::Models::StreamResponse

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_a2a/models/stream_response.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, attribute, attributes, inherited, #initialize, #to_h, #to_json, #valid?

Constructor Details

This class inherits a constructor from A2A::Models::Base

Class Method Details

.from_hash(hash) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/simple_a2a/models/stream_response.rb', line 16

def self.from_hash(hash)
  return nil if hash.nil?
  if hash["task"]
    new(task: Task.from_hash(hash["task"]))
  elsif hash["message"]
    new(message: Message.from_hash(hash["message"]))
  elsif hash["statusUpdate"]
    new(status_update: hash["statusUpdate"])
  elsif hash["artifactUpdate"]
    new(artifact_update: hash["artifactUpdate"])
  else
    new
  end
end

Instance Method Details

#artifact_update?Boolean

Returns:

  • (Boolean)


14
# File 'lib/simple_a2a/models/stream_response.rb', line 14

def artifact_update? = !artifact_update.nil?

#message?Boolean

Returns:

  • (Boolean)


12
# File 'lib/simple_a2a/models/stream_response.rb', line 12

def message?         = !message.nil?

#status_update?Boolean

Returns:

  • (Boolean)


13
# File 'lib/simple_a2a/models/stream_response.rb', line 13

def status_update?   = !status_update.nil?

#task?Boolean

Returns:

  • (Boolean)


11
# File 'lib/simple_a2a/models/stream_response.rb', line 11

def task?            = !task.nil?