Sha256: 6f35228b3b91b16e48d6fa64fb1f2dcdb41f032fba4b769e53bd81a1c2287898

Contents?: true

Size: 1.45 KB

Versions: 26

Compression:

Stored size: 1.45 KB

Contents

# frozen_string_literal: true

# 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/presenters"
require "gapic/ruby_info"

module Gapic
  module Presenters
    ##
    # A presenter for wrapper services.
    #
    class WrapperServicePresenter < ServicePresenter
      def factory_method_name
        @factory_method_name ||= begin
          method_name = ActiveSupport::Inflector.underscore name
          suffix = gem.factory_method_suffix
          method_name = "#{method_name}#{suffix}" unless method_name.end_with? suffix
          method_name = "#{method_name}_client" if Gapic::RubyInfo.excluded_method_names.include? method_name
          method_name
        end
      end

      def create_client_call
        "#{gem.namespace}.#{factory_method_name}"
      end

      def configure_client_call
        "#{gem.namespace}.configure"
      end

      def credentials_class_xref
        "`#{credentials_name_full}`"
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
gapic-generator-cloud-0.6.5 lib/gapic/presenters/wrapper_service_presenter.rb
gapic-generator-cloud-0.6.4 lib/gapic/presenters/wrapper_service_presenter.rb
gapic-generator-cloud-0.6.3 lib/gapic/presenters/wrapper_service_presenter.rb
gapic-generator-cloud-0.6.2 lib/gapic/presenters/wrapper_service_presenter.rb
gapic-generator-cloud-0.6.1 lib/gapic/presenters/wrapper_service_presenter.rb
gapic-generator-cloud-0.6.0 lib/gapic/presenters/wrapper_service_presenter.rb