Sha256: bb2ced2491ab745914713bbc01dbba05e03c1178b026f53314e021a13a9e3e45

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

<%- assert_locals method -%>
# Converts hash and nil to an options object
options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

# Customize the options with defaults
metadata = @config.rpcs.<%= method.name %>.metadata.to_h

# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
  lib_name: @config.lib_name, lib_version: @config.lib_version,
  gapic_version: ::<%= method.service.gem.version_name_full %>
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
<%- if method.routing_params? && !method.client_streaming? -%>

header_params = {
<%- method.routing_params.each_with_index do |routing_param, index| -%>
  <%- comma = index == method.routing_params.count - 1 ? "" : "," -%>
  "<%= routing_param %>" => request.<%= routing_param %><%= comma %>
<%- end -%>
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
<%- end -%>

options.apply_defaults timeout:      @config.rpcs.<%= method.name %>.timeout,
                       metadata:     metadata,
                       retry_policy: @config.rpcs.<%= method.name %>.retry_policy
options.apply_defaults metadata:     @config.metadata,
                       retry_policy: @config.retry_policy

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gapic-generator-0.1.5 templates/default/service/client/method/def/_options_defaults.erb
gapic-generator-0.1.4 templates/default/service/client/method/def/_options_defaults.erb
gapic-generator-0.1.3 templates/default/service/client/method/def/_options_defaults.erb
gapic-generator-0.1.2 templates/default/service/client/method/def/_options_defaults.erb
gapic-generator-0.1.1 templates/default/service/client/method/def/_options_defaults.erb
gapic-generator-0.1.0 templates/default/service/client/method/def/_options_defaults.erb