consul_syncer 0.3.0 → 0.4.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
  SHA1:
3
- metadata.gz: b82012df7829baf83f7b6ffdd76da1d245553ec8
4
- data.tar.gz: cf468bb76268d2ce375d401319c5f3f8eb5dce49
3
+ metadata.gz: c672bad649a207e2676b5fc1a7d56da5455dcfed
4
+ data.tar.gz: 8e9612f6ccc895d4f76fe7328af9993db88deb8c
5
5
  SHA512:
6
- metadata.gz: 56ff897ebfaa16ab68a5a04e59b7babdc227de3a1b2fd1355ebd44321cc5ba222c7e930f345d5fbc91a4487c29a9b94b2a1f053704e0e3a6e4500dda62726174
7
- data.tar.gz: 0f3a1a898a39f51ec8f2944b79ba756027662fb503a9cd218ed4b162e20d272cb65e22c7b5e2b76ed115b5766d26ae90d6a56f2c6be7de32651902f3e3d6a7dd
6
+ metadata.gz: dbdf8f7d44c0385529651e5e4732ec3e24c52ad48d884981b592d6dd8d037f20cf1807afc68127ad90ddb73e0ac6750530a41027b68f6ae692ead70e9dabcd97
7
+ data.tar.gz: aee5546deb900d9dbf4444943eed050c5f3537c5151ad64aafc49eff131c6369f99aae44366b6156a0720746a30d8452d2c801bed5cb7f84491716f5ab5489c3
data/lib/consul_syncer.rb CHANGED
@@ -9,8 +9,8 @@ require 'consul_syncer/wrapper'
9
9
  # - updates changed
10
10
  # - removes deprecated
11
11
  class ConsulSyncer
12
- def initialize(url, logger: Logger.new(STDOUT))
13
- @consul = Wrapper.new(Faraday.new(url))
12
+ def initialize(url, logger: Logger.new(STDOUT), params: {})
13
+ @consul = Wrapper.new(Faraday.new(url), params: params)
14
14
  @logger = logger
15
15
  end
16
16
 
@@ -1,3 +1,3 @@
1
1
  class ConsulSyncer
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -8,14 +8,20 @@ class ConsulSyncer
8
8
  class ConsulError < StandardError
9
9
  end
10
10
 
11
- def initialize(consul)
11
+ def initialize(consul, params:)
12
12
  @consul = consul
13
+ @params = params
13
14
  end
14
15
 
15
16
  def request(method, path, payload = nil)
17
+ if @params.any?
18
+ separator = (path.include?("?") ? "&" : "?")
19
+ path += "#{separator}#{URI.encode_www_form(@params)}"
20
+ end
21
+ args = [path]
22
+ args << payload.to_json if payload
23
+
16
24
  retry_on_error do
17
- args = [path]
18
- args << payload.to_json if payload
19
25
  response = @consul.send(method, *args)
20
26
  if response.status == 200
21
27
  if method == :get
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul_syncer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-15 00:00:00.000000000 Z
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -47,7 +47,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 2.1.0
50
+ version: 2.2.0
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="