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 +4 -4
- data/lib/consul_syncer.rb +2 -2
- data/lib/consul_syncer/version.rb +1 -1
- data/lib/consul_syncer/wrapper.rb +9 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c672bad649a207e2676b5fc1a7d56da5455dcfed
|
4
|
+
data.tar.gz: 8e9612f6ccc895d4f76fe7328af9993db88deb8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
@@ -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.
|
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-
|
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.
|
50
|
+
version: 2.2.0
|
51
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|