Class: A2A::Operation::SubscribeToTask
- Inherits:
-
Object
- Object
- A2A::Operation::SubscribeToTask
- Includes:
- Executable
- Defined in:
- lib/a2a/operation/subscribe_to_task.rb
Constant Summary collapse
- METHOD =
"SubscribeToTask"
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#tenant ⇒ Object
readonly
Returns the value of attribute tenant.
Instance Method Summary collapse
- #execute_http_json(protocol, &block) ⇒ Object
- #execute_json_rpc(protocol, &block) ⇒ Object
-
#initialize(id:, tenant: nil) ⇒ SubscribeToTask
constructor
A new instance of SubscribeToTask.
- #params ⇒ Object
Methods included from Executable
Constructor Details
#initialize(id:, tenant: nil) ⇒ SubscribeToTask
Returns a new instance of SubscribeToTask.
12 13 14 15 |
# File 'lib/a2a/operation/subscribe_to_task.rb', line 12 def initialize(id:, tenant: nil) @id = id @tenant = tenant end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/a2a/operation/subscribe_to_task.rb', line 10 def id @id end |
#tenant ⇒ Object (readonly)
Returns the value of attribute tenant.
10 11 12 |
# File 'lib/a2a/operation/subscribe_to_task.rb', line 10 def tenant @tenant end |
Instance Method Details
#execute_http_json(protocol, &block) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/a2a/operation/subscribe_to_task.rb', line 26 def execute_http_json(protocol, &block) protocol.stream("/tasks/#{id}:subscribe", method: :get) do |response| sub = Streaming::Subscription.new(response) return sub unless block sub.each(&block) end end |
#execute_json_rpc(protocol, &block) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/a2a/operation/subscribe_to_task.rb', line 17 def execute_json_rpc(protocol, &block) protocol.stream(METHOD, params) do |response| sub = Streaming::Subscription.new(response) return sub unless block sub.each(&block) end end |
#params ⇒ Object
35 36 37 |
# File 'lib/a2a/operation/subscribe_to_task.rb', line 35 def params { "id" => id, "tenant" => tenant }.compact end |