Class: Camunda::Zeebe::API
- Inherits:
-
Object
- Object
- Camunda::Zeebe::API
- Defined in:
- lib/camunda/zeebe/api.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.authentication_headers ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/camunda/zeebe/api.rb', line 19 def self.authentication_headers token = Camunda::Zeebe::OAuthToken.create channel_creds = GRPC::Core::ChannelCredentials.new auth_proc = proc { { 'authorization' => "Bearer #{token['access_token']}" } } call_creds = GRPC::Core::CallCredentials.new(auth_proc) channel_creds.compose(call_creds) end |
.client ⇒ Object
15 16 17 |
# File 'lib/camunda/zeebe/api.rb', line 15 def self.client ::Zeebe::Client::GatewayProtocol::Gateway::Stub.new(Camunda.zeebe_url, authentication_headers) end |
.run(method, params = {}) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/camunda/zeebe/api.rb', line 8 def self.run(method, params = {}) client.public_send(method, params) rescue ::GRPC::Unavailable => e Rails.logger.error e. # TODO: give people options to use other logger raise e end |