Sha256: 036168d6800af762ff58cc684f7481bfba4577cd241c1084dca26e5ef82d2805

Contents?: true

Size: 1.87 KB

Versions: 14

Compression:

Stored size: 1.87 KB

Contents

# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require "gapic/operation/retry_policy"
require "google/protobuf/well_known_types"
require "gapic/common/version"

module Gapic
  # A collection of common header values.
  module Headers
    ##
    # @param ruby_version [String] The ruby version. Defaults to `RUBY_VERSION`.
    # @param lib_name [String] The client library name.
    # @param lib_version [String] The client library version.
    # @param gax_version [String] The Gapic version. Defaults to `Gapic::Common::VERSION`.
    # @param gapic_version [String] The Gapic version.
    # @param grpc_version [String] The GRPC version. Defaults to `GRPC::VERSION`.
    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
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gapic-common-0.4.3 lib/gapic/headers.rb
gapic-common-0.4.2 lib/gapic/headers.rb
gapic-common-0.4.1 lib/gapic/headers.rb
gapic-common-0.4.0 lib/gapic/headers.rb
gapic-common-0.3.4 lib/gapic/headers.rb
gapic-common-0.3.3 lib/gapic/headers.rb
gapic-common-0.3.2 lib/gapic/headers.rb
gapic-common-0.3.1 lib/gapic/headers.rb
gapic-common-0.3.0 lib/gapic/headers.rb
gapic-common-0.2.1 lib/gapic/headers.rb
gapic-common-0.2.0 lib/gapic/headers.rb
gapic-common-0.1.0 lib/gapic/headers.rb
gapic-common-0.0.2 lib/gapic/headers.rb
gapic-common-0.0.1 lib/gapic/headers.rb