Class: Prefab::AuthInterceptor
- Inherits:
-
GRPC::ClientInterceptor
- Object
- GRPC::ClientInterceptor
- Prefab::AuthInterceptor
- Defined in:
- lib/prefab/auth_interceptor.rb
Constant Summary collapse
- VERSION =
File.exist?('VERSION') ? File.read('VERSION').chomp : ""
- CLIENT =
"prefab-cloud-ruby.#{VERSION}".freeze
Instance Method Summary collapse
- #bidi_streamer(requests:, call:, method:, metadata:, &block) ⇒ Object
- #client_streamer(requests:, call:, method:, metadata:, &block) ⇒ Object
-
#initialize(api_key) ⇒ AuthInterceptor
constructor
A new instance of AuthInterceptor.
- #request_response(request:, call:, method:, metadata:, &block) ⇒ Object
- #server_streamer(request:, call:, method:, metadata:, &block) ⇒ Object
- #shared(metadata) ⇒ Object
Constructor Details
#initialize(api_key) ⇒ AuthInterceptor
Returns a new instance of AuthInterceptor.
7 8 9 |
# File 'lib/prefab/auth_interceptor.rb', line 7 def initialize(api_key) @api_key = api_key end |
Instance Method Details
#bidi_streamer(requests:, call:, method:, metadata:, &block) ⇒ Object
23 24 25 |
# File 'lib/prefab/auth_interceptor.rb', line 23 def bidi_streamer(requests:, call:, method:, metadata:, &block) shared(, &block) end |
#client_streamer(requests:, call:, method:, metadata:, &block) ⇒ Object
15 16 17 |
# File 'lib/prefab/auth_interceptor.rb', line 15 def client_streamer(requests:, call:, method:, metadata:, &block) shared(, &block) end |
#request_response(request:, call:, method:, metadata:, &block) ⇒ Object
11 12 13 |
# File 'lib/prefab/auth_interceptor.rb', line 11 def request_response(request:, call:, method:, metadata:, &block) shared(, &block) end |
#server_streamer(request:, call:, method:, metadata:, &block) ⇒ Object
19 20 21 |
# File 'lib/prefab/auth_interceptor.rb', line 19 def server_streamer(request:, call:, method:, metadata:, &block) shared(, &block) end |
#shared(metadata) ⇒ Object
27 28 29 30 31 |
# File 'lib/prefab/auth_interceptor.rb', line 27 def shared() ['auth'] = @api_key ['client'] = CLIENT yield end |