Class: Gapic::Schema::Method

Inherits:
Proto
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/gapic/schema/wrappers.rb

Overview

Wrapper for a protobuf method.

Instance Attribute Summary collapse

Attributes inherited from Proto

#address, #descriptor, #docs, #parent

Instance Method Summary collapse

Methods inherited from Proto

#docs_leading_comments, #leading_comments, #leading_detached_comments, #path, #span, #trailing_comments

Constructor Details

#initialize(descriptor, address, docs, input, output) ⇒ Method

Initializes a method object.

Parameters:



287
288
289
290
291
# File 'lib/gapic/schema/wrappers.rb', line 287

def initialize descriptor, address, docs, input, output
  super descriptor, address, docs
  @input = input
  @output = output
end

Instance Attribute Details

#input ⇒ Object (readonly)

@ return [Message] The input message of this method.



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/gapic/schema/wrappers.rb', line 274

class Method < Proto
  extend Forwardable
  attr_reader :input, :output

  # Initializes a method object.
  # @param descriptor [Google::Protobuf::MethodDescriptorProto] the
  #   protobuf representation of this service.
  # @param address [Enumerable<String>] The address of the proto. See
  #   #address for more info.
  # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs
  #   of the proto. See #docs for more info.
  # @param input [Message] The input message of this method.
  # @param output [Message] The output message of this method.
  def initialize descriptor, address, docs, input, output
    super descriptor, address, docs
    @input = input
    @output = output
  end

  # @return [Array<Array<String>>] The parameter lists
  #   defined for this method. See `google/api/client.proto`.
  def signatures
    return [] if options.nil?

    Array(options[:".google.api.method_signature"]).map do |sig|
      String(sig).split ","
    end
  end

  # @return [Google::Longrunning::OperationInfo] Additional information
  #   regarding long-running operations.
  #   In particular, this specifies the types that are returned from
  #   long-running operations.
  #   Required for methods that return `google.longrunning.Operation`;
  #   invalid otherwise.
  def operation_info
    options[:".google.longrunning.operation_info"] if options
  end

  # @return [Google::Api::HttpRule] The HTTP bindings for this method. See
  #   `google/api/http.proto`.
  def http
    options[:".google.api.http"] if options
  end

  # @!method name
  #   @return [String] the unqualified name of the method.
  # @!method options
  #   @return [Google::Protobuf::MethodOptions] the options of this
  #     method.
  # @!method client_streaming
  #   @return [Boolean]
  #     Identifies if client streams multiple client messages.
  # @!method server_streaming
  #   @return [Boolean]
  #     Identifies if server streams multiple server messages.
  def_delegators(
    :descriptor,
    :name,
    :options,
    :client_streaming,
    :server_streaming
  )
end

#output ⇒ Object (readonly)

@ return [Message] The output message of this method.



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/gapic/schema/wrappers.rb', line 274

class Method < Proto
  extend Forwardable
  attr_reader :input, :output

  # Initializes a method object.
  # @param descriptor [Google::Protobuf::MethodDescriptorProto] the
  #   protobuf representation of this service.
  # @param address [Enumerable<String>] The address of the proto. See
  #   #address for more info.
  # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs
  #   of the proto. See #docs for more info.
  # @param input [Message] The input message of this method.
  # @param output [Message] The output message of this method.
  def initialize descriptor, address, docs, input, output
    super descriptor, address, docs
    @input = input
    @output = output
  end

  # @return [Array<Array<String>>] The parameter lists
  #   defined for this method. See `google/api/client.proto`.
  def signatures
    return [] if options.nil?

    Array(options[:".google.api.method_signature"]).map do |sig|
      String(sig).split ","
    end
  end

  # @return [Google::Longrunning::OperationInfo] Additional information
  #   regarding long-running operations.
  #   In particular, this specifies the types that are returned from
  #   long-running operations.
  #   Required for methods that return `google.longrunning.Operation`;
  #   invalid otherwise.
  def operation_info
    options[:".google.longrunning.operation_info"] if options
  end

  # @return [Google::Api::HttpRule] The HTTP bindings for this method. See
  #   `google/api/http.proto`.
  def http
    options[:".google.api.http"] if options
  end

  # @!method name
  #   @return [String] the unqualified name of the method.
  # @!method options
  #   @return [Google::Protobuf::MethodOptions] the options of this
  #     method.
  # @!method client_streaming
  #   @return [Boolean]
  #     Identifies if client streams multiple client messages.
  # @!method server_streaming
  #   @return [Boolean]
  #     Identifies if server streams multiple server messages.
  def_delegators(
    :descriptor,
    :name,
    :options,
    :client_streaming,
    :server_streaming
  )
end

Instance Method Details

#client_streaming ⇒ Boolean

Returns Identifies if client streams multiple client messages.

Returns:

  • (Boolean) —

    Identifies if client streams multiple client messages.



330
331
332
333
334
335
336
# File 'lib/gapic/schema/wrappers.rb', line 330

def_delegators(
  :descriptor,
  :name,
  :options,
  :client_streaming,
  :server_streaming
)

#http ⇒ Google::Api::HttpRule

Returns The HTTP bindings for this method. See google/api/http.proto.

Returns:



315
316
317
# File 'lib/gapic/schema/wrappers.rb', line 315

def http
  options[:".google.api.http"] if options
end

#name ⇒ String

Returns the unqualified name of the method.

Returns:

  • (String) —

    the unqualified name of the method.



330
331
332
333
334
335
336
# File 'lib/gapic/schema/wrappers.rb', line 330

def_delegators(
  :descriptor,
  :name,
  :options,
  :client_streaming,
  :server_streaming
)

#operation_info ⇒ Google::Longrunning::OperationInfo

Returns Additional information regarding long-running operations. In particular, this specifies the types that are returned from long-running operations. Required for methods that return google.longrunning.Operation; invalid otherwise.

Returns:

  • (Google::Longrunning::OperationInfo) —

    Additional information regarding long-running operations. In particular, this specifies the types that are returned from long-running operations. Required for methods that return google.longrunning.Operation; invalid otherwise.



309
310
311
# File 'lib/gapic/schema/wrappers.rb', line 309

def operation_info
  options[:".google.longrunning.operation_info"] if options
end

#options ⇒ Google::Protobuf::MethodOptions

Returns the options of this method.

Returns:



330
331
332
333
334
335
336
# File 'lib/gapic/schema/wrappers.rb', line 330

def_delegators(
  :descriptor,
  :name,
  :options,
  :client_streaming,
  :server_streaming
)

#server_streaming ⇒ Boolean

Returns Identifies if server streams multiple server messages.

Returns:

  • (Boolean) —

    Identifies if server streams multiple server messages.



330
331
332
333
334
335
336
# File 'lib/gapic/schema/wrappers.rb', line 330

def_delegators(
  :descriptor,
  :name,
  :options,
  :client_streaming,
  :server_streaming
)

#signatures ⇒ Array<Array<String>>

Returns The parameter lists defined for this method. See google/api/client.proto.

Returns:

  • (Array<Array<String>>) —

    The parameter lists defined for this method. See google/api/client.proto.



295
296
297
298
299
300
301
# File 'lib/gapic/schema/wrappers.rb', line 295

def signatures
  return [] if options.nil?

  Array(options[:".google.api.method_signature"]).map do |sig|
    String(sig).split ","
  end
end