Class: Remitmd::A2ATask
- Inherits:
-
Object
- Object
- Remitmd::A2ATask
- Defined in:
- lib/remitmd/a2a.rb
Overview
An A2A task returned by message/send, tasks/get, or tasks/cancel.
Instance Attribute Summary collapse
-
#artifacts ⇒ Object
readonly
Returns the value of attribute artifacts.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(data) ⇒ A2ATask
constructor
A new instance of A2ATask.
-
#tx_hash ⇒ String?
Extract txHash from task artifacts, if present.
Constructor Details
#initialize(data) ⇒ A2ATask
Returns a new instance of A2ATask.
90 91 92 93 94 |
# File 'lib/remitmd/a2a.rb', line 90 def initialize(data) @id = data["id"].to_s @status = A2ATaskStatus.new(data["status"] || {}) @artifacts = (data["artifacts"] || []).map { |a| A2AArtifact.new(a) } end |
Instance Attribute Details
#artifacts ⇒ Object (readonly)
Returns the value of attribute artifacts.
88 89 90 |
# File 'lib/remitmd/a2a.rb', line 88 def artifacts @artifacts end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
88 89 90 |
# File 'lib/remitmd/a2a.rb', line 88 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
88 89 90 |
# File 'lib/remitmd/a2a.rb', line 88 def status @status end |
Instance Method Details
#tx_hash ⇒ String?
Extract txHash from task artifacts, if present.
98 99 100 101 102 103 104 105 106 |
# File 'lib/remitmd/a2a.rb', line 98 def tx_hash artifacts.each do |artifact| artifact.parts.each do |part| tx = part.data["txHash"] if part.data.is_a?(Hash) return tx if tx.is_a?(String) end end nil end |