diplomat 2.1.1 → 2.1.2

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: 592187da9061242848c78fb7766bb1f132daa69c83362c5a45bab4ba0fc29b74
4
- data.tar.gz: 3ae523b3d012adedac528a97d00dbf97c1fd97972537488870cefcaa6dd1062e
3
+ metadata.gz: 8ac09c50fba20a1d2d81202396ec7ff4e22ad8012e1fed38e24d163352567cda
4
+ data.tar.gz: 3d4f798107ce788f6e0ab82cb3660ebe3b44a79f9642ff7d1ae51d2a10cbbc38
5
5
  SHA512:
6
- metadata.gz: 608a2c2a508ce613d5f45e6075bb06df173b9dae6b21a9c05e8eeaee271891a99acb44867197a5a12d2b0abac27e0d92135fd5a33cd74507b7ee96f1eee9e9b0
7
- data.tar.gz: ccccaa4bb45ff1d974bfd9db76835c91b18e6b4011b634907f7ae791d6fd06fa4d450ae666a757c9035a70bfaaed245f92f67a89387563e07cbab4102edad3ea
6
+ metadata.gz: 9e75c18e604a9b2974fc81f633b33b9620ea6e30d79a2eab59d7c9c664b49ec43e5131efeab5d904cdb881eb39b790481b544fbe88b032aa322051264237861e
7
+ data.tar.gz: 7691606b247688cf9691ffc75c7eec665c5bac8af53de5037df7832dbd42b31876f9741f4e9ffc8da5425ea1ac36c7760965b6d1225c7a689c9846719d81c090
data/lib/diplomat/acl.rb CHANGED
@@ -54,7 +54,7 @@ module Diplomat
54
54
  raise Diplomat::IdParameterRequired unless value['ID'] || value[:ID]
55
55
 
56
56
  custom_params = use_cas(@options)
57
- @raw = send_put_request(@conn, ['/v1/acl/update'], options, value, custom_params)
57
+ @raw = send_put_request(@conn, ['/v1/acl/update'], options, value.to_json, custom_params)
58
58
  parse_body
59
59
  end
60
60
 
@@ -64,7 +64,7 @@ module Diplomat
64
64
  # @return [Hash] The result Acl
65
65
  def create(value, options = {})
66
66
  custom_params = use_cas(@options)
67
- @raw = send_put_request(@conn, ['/v1/acl/create'], options, value, custom_params)
67
+ @raw = send_put_request(@conn, ['/v1/acl/create'], options, value.to_json, custom_params)
68
68
  parse_body
69
69
  end
70
70
 
@@ -25,13 +25,13 @@ module Diplomat
25
25
  raise(Diplomat::DeprecatedArgument, 'Script usage is deprecated, replace by an array of args')
26
26
  end
27
27
 
28
- definition = {
28
+ definition = JSON.generate(
29
29
  'ID' => check_id,
30
30
  'Name' => name,
31
31
  'Notes' => notes,
32
32
  'Args' => args,
33
33
  'Interval' => interval
34
- }
34
+ )
35
35
  ret = send_put_request(@conn, ['/v1/agent/check/register'], options, definition)
36
36
  ret.status == 200
37
37
  end
@@ -45,12 +45,12 @@ module Diplomat
45
45
  # @param options [Hash] options parameter hash
46
46
  # @return [Boolean] Success
47
47
  def register_ttl(check_id, name, notes, ttl, options = {})
48
- definition = {
48
+ definition = JSON.generate(
49
49
  'ID' => check_id,
50
50
  'Name' => name,
51
51
  'Notes' => notes,
52
52
  'TTL' => ttl
53
- }
53
+ )
54
54
  ret = send_put_request(@conn, ['/v1/agent/check/register'], options, definition)
55
55
  ret.status == 200
56
56
  end
@@ -71,10 +71,10 @@ module Diplomat
71
71
  # @param options [Hash] options parameter hash
72
72
  # @return [Integer] Status code
73
73
  def update_ttl(check_id, status, output = nil, options = {})
74
- definition = {
74
+ definition = JSON.generate(
75
75
  'Status' => status,
76
76
  'Output' => output
77
- }
77
+ )
78
78
  ret = send_put_request(@conn, ["/v1/agent/check/update/#{check_id}"], options, definition)
79
79
  ret.status == 200
80
80
  end
data/lib/diplomat/kv.rb CHANGED
@@ -167,7 +167,7 @@ module Diplomat
167
167
  custom_params = []
168
168
  custom_params << dc(options)
169
169
  custom_params << transaction_consistency(options)
170
- raw = send_put_request(@conn_no_err, ['/v1/txn'], options, value, custom_params)
170
+ raw = send_put_request(@conn_no_err, ['/v1/txn'], options, JSON.generate(value), custom_params)
171
171
  transaction_return JSON.parse(raw.body), options
172
172
  end
173
173
 
data/lib/diplomat/node.rb CHANGED
@@ -27,7 +27,7 @@ module Diplomat
27
27
  # @param options [Hash] options parameter hash
28
28
  # @return [Boolean]
29
29
  def register(definition, options = {})
30
- register = send_put_request(@conn, ['/v1/catalog/register'], options, definition)
30
+ register = send_put_request(@conn, ['/v1/catalog/register'], options, JSON.dump(definition))
31
31
  register.status == 200
32
32
  end
33
33
 
@@ -36,7 +36,7 @@ module Diplomat
36
36
  # @param options [Hash] options parameter hash
37
37
  # @return [Boolean]
38
38
  def deregister(definition, options = {})
39
- deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options, definition)
39
+ deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options, JSON.dump(definition))
40
40
  deregister.status == 200
41
41
  end
42
42
  end
@@ -51,7 +51,7 @@ module Diplomat
51
51
  # @return [Boolean]
52
52
  def update(key, definition, options = {})
53
53
  custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
54
- ret = send_put_request(@conn, ["/v1/query/#{key}"], options, definition, custom_params)
54
+ ret = send_put_request(@conn, ["/v1/query/#{key}"], options, JSON.dump(definition), custom_params)
55
55
  ret.status == 200
56
56
  end
57
57
 
@@ -214,7 +214,7 @@ module Diplomat
214
214
  connection.put do |req|
215
215
  req.url rest_options[:url_prefix] ? rest_options[:url_prefix] + concat_url(url) : concat_url(url)
216
216
  rest_options[:headers].map { |k, v| req.headers[k.to_sym] = v } unless rest_options[:headers].nil?
217
- req.body = JSON.dump(data) unless data.nil?
217
+ req.body = data unless data.nil?
218
218
  end
219
219
  end
220
220
 
@@ -47,7 +47,7 @@ module Diplomat
47
47
  # @return [Boolean]
48
48
  def register(definition, options = {})
49
49
  url = options[:path] || ['/v1/agent/service/register']
50
- register = send_put_request(@conn, url, options, definition)
50
+ register = send_put_request(@conn, url, options, JSON.dump(definition))
51
51
  register.status == 200
52
52
  end
53
53
 
@@ -74,7 +74,7 @@ module Diplomat
74
74
  # @param options [Hash] options parameter hash
75
75
  # @return [Boolean]
76
76
  def deregister_external(definition, options = {})
77
- deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options, definition)
77
+ deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options, JSON.dump(definition))
78
78
  deregister.status == 200
79
79
  end
80
80
 
@@ -1,3 +1,3 @@
1
1
  module Diplomat
2
- VERSION = '2.1.1'.freeze
2
+ VERSION = '2.1.2'.freeze
3
3
  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.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hamelink