lib/gapic/presenters/service_presenter.rb in gapic-generator-0.2.0 vs lib/gapic/presenters/service_presenter.rb in gapic-generator-0.2.2
- old
+ new
@@ -25,13 +25,14 @@
#
class ServicePresenter
include Gapic::Helpers::FilepathHelper
include Gapic::Helpers::NamespaceHelper
- def initialize api, service
+ def initialize api, service, parent_service: nil
@api = api
@service = service
+ @parent_service = parent_service
end
def gem
GemPresenter.new @api
end
@@ -144,10 +145,11 @@
def client_file_name
client_file_path.split("/").last
end
def client_endpoint
+ return @parent_service.client_endpoint if @parent_service
@service.host || default_config(:default_host) || "localhost"
end
def client_scopes
@service.scopes || default_config(:oauth_scopes)
@@ -265,11 +267,10 @@
ruby_file_path @api, "#{proto_service_name_full}::#{operations_name}"
end
def lro_service
lro = @service.parent.parent.files.find { |file| file.name == "google/longrunning/operations.proto" }
-
- return ServicePresenter.new @api, lro.services.first unless lro.nil?
+ return ServicePresenter.new @api, lro.services.first, parent_service: self unless lro.nil?
end
def config_channel_args
{ "grpc.service_config_disable_resolution" => 1 }
end