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.
8 9 10 |
# File 'lib/prefab/auth_interceptor.rb', line 8 def initialize(api_key) @api_key = api_key end |
Instance Method Details
#bidi_streamer(requests:, call:, method:, metadata:, &block) ⇒ Object
24 25 26 |
# File 'lib/prefab/auth_interceptor.rb', line 24 def bidi_streamer(requests:, call:, method:, metadata:, &block) shared(, &block) end |
#client_streamer(requests:, call:, method:, metadata:, &block) ⇒ Object
16 17 18 |
# File 'lib/prefab/auth_interceptor.rb', line 16 def client_streamer(requests:, call:, method:, metadata:, &block) shared(, &block) end |
#request_response(request:, call:, method:, metadata:, &block) ⇒ Object
12 13 14 |
# File 'lib/prefab/auth_interceptor.rb', line 12 def request_response(request:, call:, method:, metadata:, &block) shared(, &block) end |
#server_streamer(request:, call:, method:, metadata:, &block) ⇒ Object
20 21 22 |
# File 'lib/prefab/auth_interceptor.rb', line 20 def server_streamer(request:, call:, method:, metadata:, &block) shared(, &block) end |
#shared(metadata) ⇒ Object
28 29 30 31 32 |
# File 'lib/prefab/auth_interceptor.rb', line 28 def shared() ['auth'] = @api_key ['client'] = CLIENT yield end |