Class: Jetra::Grpc::Adapter
- Inherits:
-
Interface::Service
- Object
- Interface::Service
- Jetra::Grpc::Adapter
- Defined in:
- lib/jetra/adapter/grpc.rb
Instance Method Summary collapse
- #call(request, _unused_call) ⇒ Object
-
#initialize(app, &custom_block) ⇒ Adapter
constructor
A new instance of Adapter.
Constructor Details
#initialize(app, &custom_block) ⇒ Adapter
Returns a new instance of Adapter.
17 18 19 20 21 22 |
# File 'lib/jetra/adapter/grpc.rb', line 17 def initialize(app, &custom_block) @app = app @custom_block = custom_block end |
Instance Method Details
#call(request, _unused_call) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jetra/adapter/grpc.rb', line 24 def call(request, _unused_call) if @custom_block @custom_block.call(request) end res = @app.call(request.route, request.params, request.headers, request.body) anyBody = Google::Protobuf::Any.new anyBody.pack(res.body) response = Response.new response.status = res.status response.body = anyBody response end |