Class: A2A::Proto::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/proto.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, request_type:, response_type:, server_streaming:, http_bindings:) ⇒ Operation

Returns a new instance of Operation.



34
35
36
37
38
39
40
41
# File 'lib/a2a/proto.rb', line 34

def initialize(name:, request_type:, response_type:,
               server_streaming:, http_bindings:)
  @name             = name
  @request_type     = request_type
  @response_type    = response_type
  @server_streaming = server_streaming
  @http_bindings    = http_bindings
end

Instance Attribute Details

#http_bindingsObject (readonly)

Returns the value of attribute http_bindings.



31
32
33
# File 'lib/a2a/proto.rb', line 31

def http_bindings
  @http_bindings
end

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/a2a/proto.rb', line 31

def name
  @name
end

#request_typeObject (readonly)

Returns the value of attribute request_type.



31
32
33
# File 'lib/a2a/proto.rb', line 31

def request_type
  @request_type
end

#response_typeObject (readonly)

Returns the value of attribute response_type.



31
32
33
# File 'lib/a2a/proto.rb', line 31

def response_type
  @response_type
end

#server_streamingObject (readonly)

Returns the value of attribute server_streaming.



31
32
33
# File 'lib/a2a/proto.rb', line 31

def server_streaming
  @server_streaming
end

Instance Method Details

#grpc_methodObject



61
# File 'lib/a2a/proto.rb', line 61

def grpc_method     = name

#inspectObject



67
68
69
# File 'lib/a2a/proto.rb', line 67

def inspect
  "#<Proto::Operation #{name} #{rest_verb.upcase} #{rest_path}>"
end

#json_rpc_methodObject

JSON-RPC and gRPC method names are identical to the RPC name.



60
# File 'lib/a2a/proto.rb', line 60

def json_rpc_method = name

#request_schemaObject

Bridge to Schema: convert proto PascalCase type name to the JSON schema title used by A2A::Schema[].

"SendMessageRequest" => Schema["Send Message Request"]


50
51
52
# File 'lib/a2a/proto.rb', line 50

def request_schema
  A2A::Schema[pascal_to_title(request_type)]
end

#response_schemaObject



54
55
56
57
# File 'lib/a2a/proto.rb', line 54

def response_schema
  return nil if response_type.include?(".")  # google.protobuf.Empty
  A2A::Schema[pascal_to_title(response_type)]
end

#rest_pathObject



65
# File 'lib/a2a/proto.rb', line 65

def rest_path = http_bindings.first.path

#rest_verbObject

REST binding from the primary (non-tenant) HTTP annotation.



64
# File 'lib/a2a/proto.rb', line 64

def rest_verb = http_bindings.first.verb

#server_streaming?Boolean

Returns:

  • (Boolean)


43
# File 'lib/a2a/proto.rb', line 43

def server_streaming? = @server_streaming