Module: Gapic::Headers

Defined in:
lib/gapic/headers.rb

Overview

A collection of common header values.

Class Method Summary collapse

Class Method Details

.x_goog_api_client(ruby_version: nil, lib_name: nil, lib_version: nil, gax_version: nil, gapic_version: nil, grpc_version: nil) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/gapic/headers.rb', line 29

def self.x_goog_api_client ruby_version: nil, lib_name: nil, lib_version: nil,
                           gax_version: nil, gapic_version: nil, grpc_version: nil
  ruby_version ||= ::RUBY_VERSION
  gax_version  ||= ::Gapic::Common::VERSION
  grpc_version ||= ::GRPC::VERSION if defined? ::GRPC

  x_goog_api_client_header = ["gl-ruby/#{ruby_version}"]
  x_goog_api_client_header << "#{lib_name}/#{lib_version}" if lib_name
  x_goog_api_client_header << "gax/#{gax_version}"
  x_goog_api_client_header << "gapic/#{gapic_version}" if gapic_version
  x_goog_api_client_header << "grpc/#{grpc_version}" if grpc_version
  x_goog_api_client_header.join " ".freeze
end