istox 0.1.152.1.test2 → 0.1.152.1.test3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e814e3426b11eaaf2d622ce9aabd2dfcbafa4723a8655de7c248c179b3b555a
4
- data.tar.gz: 4cdbdfd22e46fd3cf2978fbbc2fb0d2de16396efc2d52024b14c8b4227ab3151
3
+ metadata.gz: 758fc766dfc65e9d4d0b23738b9b307cdcb236a6c285026b31547c90bfa394df
4
+ data.tar.gz: 5be8eb757880769faa79f50a946639a5887b665331c67840d7cf7201941b9068
5
5
  SHA512:
6
- metadata.gz: '09fec3e94fb7d026b7034aba33ace4b553e0e5fd46bf7f55ad6575db62566e5038da3625d82f2e30f2377f2f3b04a7e7e80c39d25131558462e88e81a6446e36'
7
- data.tar.gz: d58b71014e36ca247313eef55b7d4f157161ff27f74259d8d86643f81e5367eb8f9de059bd625e642b9f8e360d398a0a6b0aa79cb2ed04b2568c8fcc28641d8f
6
+ metadata.gz: 531d98e17c4ed0ab48abbd6117175874ca3a8c8dc13b4bcc065987f2b100a7157f96191dadcee1438851560ae85615b861d2c59c816e849ffdf8f1670d05f36a
7
+ data.tar.gz: 7f87201248c55674239a2a86b0bd4b195e9ef29e696924ac7abe9d61be7409b9fd93e5d6efea9e6cfd5195e5d6bbb5b5ca86afa9978df0dbdaf93e41ad0a4c1f
@@ -3,6 +3,8 @@ require 'istox/helpers/logger'
3
3
  module Istox
4
4
  class GrpcClient
5
5
  class << self
6
+ attr_accessor :client_metadata_hook
7
+
6
8
  def add_host(host_type, url)
7
9
  @@hosts = {} unless defined?(@@hosts)
8
10
 
@@ -48,7 +50,7 @@ module Istox
48
50
  log.info "Calling method in grpc method: #{method.inspect}, params: #{keyword_args.inspect}"
49
51
  t1 = Time.now
50
52
 
51
- result = get_host(host_type, service).call(method, keyword_args)
53
+ result = get_host(host_type, service).call(method, keyword_args, client_metadata)
52
54
  log.info "Time taken for grpc execution: #{Time.now - t1} seconds"
53
55
 
54
56
  return_values = ::Istox::CommonHelper.to_open_struct(result.message)
@@ -94,6 +96,16 @@ module Istox
94
96
  channel_args: default_channel_options
95
97
  }
96
98
  end
99
+
100
+ def client_metadata
101
+ return {} if @client_metadata_hook.blank?
102
+
103
+ unless @client_metadata_hook.methods.include?(:inject_metadata)
104
+ raise StandardError, 'Unable to find method .inject_metadata, have you forgotten to define it in your hook?'
105
+ end
106
+
107
+ @client_metadata_hook.inject_metadata
108
+ end
97
109
  end
98
110
  end
99
111
  end
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.152.1.test2'.freeze
2
+ VERSION = '0.1.152.1.test3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.152.1.test2
4
+ version: 0.1.152.1.test3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng