lib/gapic/presenters/service_presenter.rb in gapic-generator-0.8.0 vs lib/gapic/presenters/service_presenter.rb in gapic-generator-0.9.0
- old
+ new
@@ -359,10 +359,14 @@
def grpc_service_config
return unless @api.grpc_service_config&.service_level_configs&.key? grpc_full_name
@api.grpc_service_config.service_level_configs[grpc_full_name]
end
+ def service_config_presenter
+ ServiceConfigPresenter.new grpc_service_config
+ end
+
##
# The short proto name for this service
#
# @return [String]
def grpc_service_name
@@ -401,9 +405,23 @@
# if REST code is generated, this should be disambiguated into the "GRPC client"
#
# @return [String]
def grpc_client_designation
generate_rest_clients? ? "GRPC client" : "client"
+ end
+
+ ##
+ # The method to use for quick start samples. Normally this is simply the
+ # first non-client-streaming method defined, but it can be overridden via
+ # a gem config.
+ #
+ # @return [Gapic::Presenters::MethodPresenter]
+ #
+ def quick_start_method
+ gem_config = @api.configuration[:gem]
+ preferred_method = gem_config[:quick_start_method] if gem_config
+ result = methods.find { |meth| meth.name == preferred_method } if preferred_method
+ result || methods.find { |meth| !meth.client_streaming? }
end
private
def default_config key