Class: Immudb::Interceptor

Inherits:
GRPC::ClientInterceptor
  • Object
show all
Defined in:
lib/immudb/interceptor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tokenObject

Returns the value of attribute token.



15
16
17
# File 'lib/immudb/interceptor.rb', line 15

def token
  @token
end

Instance Method Details

#inspectObject

hide token



27
28
29
# File 'lib/immudb/interceptor.rb', line 27

def inspect
  to_s
end

#request_response(request: nil, call: nil, method: nil, metadata: nil) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/immudb/interceptor.rb', line 17

def request_response(request: nil, call: nil, method: nil, metadata: nil)
  ["authorization"] = "Bearer #{token}" if token
  begin
    super
  rescue GRPC::Unknown => e
    raise Error, e.details
  end
end