Sha256: 2b474d90a950147e85b24dda0d6f650b5a1683aaeca5d94ae2b9c9f8893ac8fd

Contents?: true

Size: 940 Bytes

Versions: 3

Compression:

Stored size: 940 Bytes

Contents

<%- assert_locals service -%>
<% @requires = capture do %>
  require "<%= service.proto_service_require %>"
<% end %>
##
# REST service stub for the <%= service.name %> service.
# service stub contains baseline method implementations
# including transcoding, making the REST call and deserialing the response
#
class <%= service.rest.service_stub_name %>
  def initialize endpoint:, credentials:
    # These require statements are intentionally placed here to initialize
    # the REST modules only when it's required.
    require "gapic/rest"

    @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
  end

  <%- service.methods.each do |method| -%>

  <%= indent_tail render(partial: "service/rest/service_stub/method/def", locals: { method: method }), 2 %>

  <%= indent_tail render(partial: "service/rest/service_stub/grpc_transcoding_method/def", locals: { method: method }), 2 %>
  <%- end %>
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gapic-generator-0.11.0 templates/default/service/rest/service_stub/_service_stub.erb
gapic-generator-0.10.1 templates/default/service/rest/service_stub/_service_stub.erb
gapic-generator-0.10.0 templates/default/service/rest/service_stub/_service_stub.erb