Class: A2A::Operation::CancelTask
- Inherits:
-
Object
- Object
- A2A::Operation::CancelTask
- Includes:
- Executable
- Defined in:
- lib/a2a/operation/cancel_task.rb
Constant Summary collapse
- METHOD =
"CancelTask"
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#tenant ⇒ Object
readonly
Returns the value of attribute tenant.
Instance Method Summary collapse
- #execute_http_json(protocol) ⇒ Object
- #execute_json_rpc(protocol) ⇒ Object
-
#initialize(id:, metadata: nil, tenant: nil) ⇒ CancelTask
constructor
A new instance of CancelTask.
- #params ⇒ Object
Methods included from Executable
Constructor Details
#initialize(id:, metadata: nil, tenant: nil) ⇒ CancelTask
Returns a new instance of CancelTask.
12 13 14 15 16 |
# File 'lib/a2a/operation/cancel_task.rb', line 12 def initialize(id:, metadata: nil, tenant: nil) @id = id @metadata = @tenant = tenant end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/a2a/operation/cancel_task.rb', line 10 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
10 11 12 |
# File 'lib/a2a/operation/cancel_task.rb', line 10 def @metadata end |
#tenant ⇒ Object (readonly)
Returns the value of attribute tenant.
10 11 12 |
# File 'lib/a2a/operation/cancel_task.rb', line 10 def tenant @tenant end |
Instance Method Details
#execute_http_json(protocol) ⇒ Object
25 26 27 28 |
# File 'lib/a2a/operation/cancel_task.rb', line 25 def execute_http_json(protocol) body = ? { "metadata" => } : {} Task.from_h(protocol.post("/tasks/#{id}:cancel", body: body)) end |
#execute_json_rpc(protocol) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/a2a/operation/cancel_task.rb', line 18 def execute_json_rpc(protocol) raw = protocol.post(METHOD, params) raise A2A.from_json_rpc_error(raw["error"]) if raw["error"] Task.from_h(Hash(raw["result"])) end |
#params ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/a2a/operation/cancel_task.rb', line 30 def params { "id" => id, "metadata" => , "tenant" => tenant }.compact end |