diplomat 2.5.1 → 2.6.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: 37d27cdf582386605a038f4bc076015706d23987826ae5ba5aef9ff4703a12dc
4
- data.tar.gz: ab5a5a143db7fa3f81f1fe206fb53ddb9cad5d9c8728e17c1a540320e5befa40
3
+ metadata.gz: 25c0b2769edc31ef7e21ce9a27bb80640ad924e8c7e5d3941ad85a7cf94605da
4
+ data.tar.gz: b42997b367d7a4f17358823e773c5ade86789677c273d02f02ca799baba8c79f
5
5
  SHA512:
6
- metadata.gz: 6280f5bfbf670477180997708238033f2864a9c98c0cb0fa6ffadc98f3bd8c82164398a024c1a20d48e5fb4571f8288dfd7ecdfe57e8f485171c2f0bf42e1a14
7
- data.tar.gz: 1f803aa87fd29265d4d2434663e0c2847a73231458072d9a1e0b69a67d328fa759a0eab14fc8f2be4a476ce3e2753e4270eaf11b0e3f80998eda7b5ed4f70942
6
+ metadata.gz: cd6483e59dd18715f52bb783d4cdfaaa4ba3f0b16e5f045c3a7bfea6cfea5f002bda8f3ca85fe33854be9e69e1ae523ba3277699204bcf07c07a8476c84af980
7
+ data.tar.gz: 0c92e00358566383f63105d6c656db1b641199fefe03aefdabed592dd4efdf6eceeaa5e7e1a5a1c8ad8538bdf6ed5fdbc48ecd4400a9b556d40a5ab42b1bbeaf
@@ -33,17 +33,25 @@ module Diplomat
33
33
  # Get service health
34
34
  # @param s [String] the service
35
35
  # @param options [Hash] options parameter hash
36
+ # @param meta [Hash] output structure containing header information about the request (index)
36
37
  # @return [OpenStruct] all data associated with the node
37
38
  # rubocop:disable Metrics/PerceivedComplexity
38
- def service(s, options = {})
39
+ def service(s, options = {}, meta = nil)
39
40
  custom_params = []
40
41
  custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
41
42
  custom_params << ['passing'] if options[:passing]
42
43
  custom_params += [*options[:tag]].map { |value| use_named_parameter('tag', value) } if options[:tag]
43
44
  custom_params << use_named_parameter('near', options[:near]) if options[:near]
44
45
  custom_params << use_named_parameter('node-meta', options[:node_meta]) if options[:node_meta]
46
+ custom_params << use_named_parameter('index', options[:index]) if options[:index]
45
47
 
46
48
  ret = send_get_request(@conn, ["/v1/health/service/#{s}"], options, custom_params)
49
+ if meta && ret.headers
50
+ meta[:index] = ret.headers['x-consul-index'] if ret.headers['x-consul-index']
51
+ meta[:knownleader] = ret.headers['x-consul-knownleader'] if ret.headers['x-consul-knownleader']
52
+ meta[:lastcontact] = ret.headers['x-consul-lastcontact'] if ret.headers['x-consul-lastcontact']
53
+ end
54
+
47
55
  JSON.parse(ret.body).map { |service| OpenStruct.new service }
48
56
  end
49
57
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diplomat
4
- VERSION = '2.5.1'
4
+ VERSION = '2.6.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diplomat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hamelink
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-02-10 00:00:00.000000000 Z
13
+ date: 2021-09-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -252,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  - !ruby/object:Gem::Version
253
253
  version: '0'
254
254
  requirements: []
255
- rubygems_version: 3.1.4
255
+ rubygems_version: 3.1.6
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Diplomat is a simple wrapper for Consul