etcd-discovery 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/etcd-discovery/host.rb +5 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7089eb535dddfc946e32637321395451c748d86d
4
- data.tar.gz: c8e76dedbe3dfb033b3e723f7c371d34dc62a481
3
+ metadata.gz: 960dc0430e6a20341f0fef6abf70a983809ac5d5
4
+ data.tar.gz: cec0aeba3b3d129be5f8e39cedd8c7e72803a914
5
5
  SHA512:
6
- metadata.gz: 4f91a7f283f8a72238aa61134247a8106f5646762a3dc0dcfdb2055df72dbe7803fb814eeae0b7560d71764415d09fda6e408d22a0fdd6917cc7ef5a92ed6031
7
- data.tar.gz: 17eed9d65421cf3a8f02c8cbbb56193cd31c293ee6f9a29fc6319e07b542b54b667c069a604413ebce901e959b522224baeaa4e7687563f5274a31bd48d20e7e
6
+ metadata.gz: 955d3be4ffaabf4e733a940a7e5defa90f1dd4e688477595bd4b2bf67840b416cafe369492af8dd74efa5940234ecdb0757e61db247c7a951f5d103e88e60ee4
7
+ data.tar.gz: acd4e8b4d6ba5e228064174c379ace5aec37ffdc6080a46b27f65d948e8ff83acc1f981825b391e570f83d732f4be424d5bcec6502887da3964fccf78de37e04
@@ -13,24 +13,23 @@ module EtcdDiscovery
13
13
  else
14
14
  raise TypeError, "requires a Etcd::Node or a Hash, not a #{arg.class}"
15
15
  end
16
- if !attributes.has_key?('name') or !attributes.has_key?('port')
17
- raise InvalidHost, "attributes 'name' and 'port' should be defined"
16
+ if !attributes.has_key?('name') or !attributes.has_key?('ports')
17
+ raise InvalidHost, "attributes 'name' and 'ports' should be defined"
18
18
  end
19
19
  attributes['user'] = "" if attributes['user'].nil?
20
20
  attributes['password'] = "" if attributes['password'].nil?
21
- attributes['scheme'] = "http" if attributes['scheme'].nil?
22
21
  end
23
22
 
24
23
  def to_json
25
24
  attributes.to_json
26
25
  end
27
26
 
28
- def to_uri
27
+ def to_uri(scheme = "http")
29
28
  a = attributes # Shorten name
30
29
  if a['user'].empty?
31
- URI("#{a['scheme']}://#{a['name']}:#{a['port']}")
30
+ URI("#{scheme}://#{a['name']}:#{a['ports'][scheme]}")
32
31
  else
33
- URI("#{a['scheme']}://#{a['user']}:#{a['password']}@#{a['name']}:#{a['port']}")
32
+ URI("#{scheme}://#{a['user']}:#{a['password']}@#{a['name']}:#{a['ports'][scheme]}")
34
33
  end
35
34
  end
36
35
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etcd-discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Léo Unbekandt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-29 00:00:00.000000000 Z
11
+ date: 2014-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: etcd