gruf 2.9.0 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77be459526bb01a2e709cb26663e0b2bbdc614eb28de7084a132c14d741fef66
4
- data.tar.gz: b36e8446fd325c42b9c494370b09fd9ecd2364d5a84194683f5d9d81961dd5b2
3
+ metadata.gz: b132efe87ccf85ffcf897a67f5c268b8696e60e5f2b280c93c52f08fea1aa122
4
+ data.tar.gz: 6a1d99886e075daac23eadeabd5e347c92d4fdc7659f7dd639d7e79e38c6b6f8
5
5
  SHA512:
6
- metadata.gz: 9d11c575a288e18321aeee6de57b9b9c8a9db09e2c200ce3c5a50d7331e7e1af2975bcba2ae276917e0bf087bbc7c1f0726b4df13d9861bab361c66069a691f9
7
- data.tar.gz: baed74a1e86746ae86314f4fa33065f1b0a3d9ae479c8f288f444444be24e78d76a9f0337cdcfe62b9637d53e6709cf031122cf8728bf709abaa4e6fd79ad788
6
+ metadata.gz: b5140ea90e6bc018cef228f7bece3096cd389bec36cc4b80f5e1a9b2ebefbab7afe494146c9f4843418f06ffe27d404885d470477c732986befe94b69191297d
7
+ data.tar.gz: fb3baf2ad10bf606b57c37f45d419e11c41bb34ce56c9801d3367cb471cfe22f097b42bbfa60aa77cbb3eda338c947eee48f909b2866df1bf660953772ac2b64
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 2.10.0
6
+
7
+ - Drop support for Ruby 2.4/2.5 to align with Ruby EOL schedule, supporting 2.6+ only
8
+ - Allow for float/TimeSpec timeout values on clients
9
+
5
10
  ### 2.9.0
6
11
 
7
12
  - Change to racially neutral terminology across library
data/gruf.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.executables << 'gruf'
34
34
  spec.require_paths = ['lib']
35
35
 
36
- spec.required_ruby_version = '>= 2.4', '< 3.1'
36
+ spec.required_ruby_version = '>= 2.6', '< 3.1'
37
37
 
38
38
  spec.add_development_dependency 'bundler', '~> 1.11'
39
39
  spec.add_development_dependency 'bundler-audit', '>= 0.6'
data/lib/gruf/client.rb CHANGED
@@ -62,7 +62,7 @@ module Gruf
62
62
  @opts[:hostname] = @opts.fetch(:hostname, Gruf.default_client_host)
63
63
  @opts[:channel_credentials] = @opts.fetch(:channel_credentials, Gruf.default_channel_credentials)
64
64
  @error_factory = Gruf::Client::ErrorFactory.new
65
- client_options[:timeout] = client_options[:timeout].to_i if client_options.key?(:timeout)
65
+ client_options[:timeout] = parse_timeout(client_options[:timeout]) if client_options.key?(:timeout)
66
66
  client = "#{service}::Stub".constantize.new(@opts[:hostname], build_ssl_credentials, **client_options)
67
67
  super(client)
68
68
  end
@@ -216,5 +216,27 @@ module Gruf
216
216
  Gruf::Serializers::Errors::Json
217
217
  end
218
218
  end
219
+
220
+ ##
221
+ # Handle various timeout values and prevent improper value setting
222
+ #
223
+ # @see GRPC::Core::TimeConsts#from_relative_time
224
+ # @param [mixed] timeout
225
+ # @return [Float]
226
+ # @return [GRPC::Core::TimeSpec]
227
+ #
228
+ def parse_timeout(timeout)
229
+ if timeout.nil?
230
+ GRPC::Core::TimeConsts::ZERO
231
+ elsif timeout.is_a?(GRPC::Core::TimeSpec)
232
+ timeout
233
+ elsif timeout.is_a?(Numeric)
234
+ timeout
235
+ elsif timeout.respond_to?(:to_f)
236
+ timeout.to_f
237
+ else
238
+ raise ArgumentError, 'timeout is not a valid value: does not respond to to_f'
239
+ end
240
+ end
219
241
  end
220
242
  end
@@ -64,7 +64,7 @@ module Gruf
64
64
  # @return [String]
65
65
  #
66
66
  def route_key
67
- @method[1..-1].underscore.tr('/', '.')
67
+ @method[1..].underscore.tr('/', '.')
68
68
  end
69
69
  end
70
70
  end
data/lib/gruf/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
17
  #
18
18
  module Gruf
19
- VERSION = '2.9.0'
19
+ VERSION = '2.10.0'
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-02 00:00:00.000000000 Z
11
+ date: 2021-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -385,7 +385,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
385
385
  requirements:
386
386
  - - ">="
387
387
  - !ruby/object:Gem::Version
388
- version: '2.4'
388
+ version: '2.6'
389
389
  - - "<"
390
390
  - !ruby/object:Gem::Version
391
391
  version: '3.1'