Class: Gapic::Presenters::WrapperServicePresenter

Inherits:
ServicePresenter
  • Object
show all
Defined in:
lib/gapic/presenters/wrapper_service_presenter.rb

Overview

A presenter for wrapper services.

Instance Method Summary collapse

Constructor Details

#initialize(*args, **kwargs) ⇒ WrapperServicePresenter

Returns a new instance of WrapperServicePresenter.



27
28
29
30
# File 'lib/gapic/presenters/wrapper_service_presenter.rb', line 27

def initialize *args, **kwargs
  super(*args, **kwargs)
  @rest = WrapperServiceRestPresenter.new self, @api
end

Instance Method Details

#configure_client_callObject



62
63
64
# File 'lib/gapic/presenters/wrapper_service_presenter.rb', line 62

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

#create_client_callObject



58
59
60
# File 'lib/gapic/presenters/wrapper_service_presenter.rb', line 58

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

#credentials_class_xrefObject



66
67
68
# File 'lib/gapic/presenters/wrapper_service_presenter.rb', line 66

def credentials_class_xref
  "`#{credentials_name_full}`"
end

#factory_method_nameObject



32
33
34
35
36
37
38
39
40
# File 'lib/gapic/presenters/wrapper_service_presenter.rb', line 32

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

#usable_service_presenterWrapperServicePresenter, ...

Returns this service presenter if there is a grpc client. Otherwise, returns the corresponding rest service presenter if there isn't a grpc client but there is a rest client. Otherwise, returns nil if there is neither client.



50
51
52
53
54
55
56
# File 'lib/gapic/presenters/wrapper_service_presenter.rb', line 50

def usable_service_presenter
  if @api.generate_grpc_clients?
    self
  elsif @api.generate_rest_clients? && methods_rest_bindings?
    rest
  end
end