consul-ruby-client 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGM1NWRiMjY3OWUyNGM1MDZjMGUwOGFjYTFiY2Y0NjhmYzYwOTk1OQ==
4
+ YjVlYmRjNDgxNTI3ZTkwM2U0NTI3ODA5YjljNjJjYTAyYmY2ZjY3Mg==
5
5
  data.tar.gz: !binary |-
6
- YzM0YWVjMDRjN2M4YTk5MDAzYzJlNGVkMTYwZWQ5OThhMjM3ZGIzNw==
6
+ NDcxODgzMDkzNWQwM2EzZDRjZWIwOGVkMDc4NGIzMWFlMjgxOWQ1NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDk2YTEzMmI3MmNlMjFjMzUwOGRmYmRkYTYwYjdlNGI3ODJiODQyMTg4NWEy
10
- Y2VjYTkzYjhjOTdlMjU4OGM2MmMxMTgyMDc5NjE2MGQ0MGQyYmZiMDIxNzM3
11
- ZTg5MWJmMTc5NDg5ODJkMWJkZjM3YTI1ZjM3ZDY5YmM2M2Q4MTI=
9
+ OTczMjJjMGNkMWU5YTQyMzlhYTE1OWQyMDM5ZmI4MDExYzBiOGQwNTg3NmYx
10
+ ZjRiYjMyYzgwOTg5ZDkxOGI2NTEwZmUzM2M2ODFmNjY1YjYxM2Y0ZjVhY2Nm
11
+ NjgxMmQzY2JmNDE1NGE0OGFiYmFhNDZmMjU0ZDI2ZDU3YmVhM2Q=
12
12
  data.tar.gz: !binary |-
13
- YmM1YjYwMDI4ZTU2OTcwNzcwOWUzMjMzZTU4YjViMDA5ZDRiMDQ4YThlYTY1
14
- NGQ1MTU3MjYxZmUyNGZiZWU0Nzc0YzFlMmMzNjE1MmJiZDU4MzlkNjZmMDg5
15
- OWFiMzY2N2UxM2RhYjgyZjhmYmJjYTM4OGI5ZTFhNDU3ZDM2MmI=
13
+ NjkzMjQxM2FkNDY4NjFjNjRhMmRiMDYzN2UzZTlkZWVhNTlhMDQ0ODEwMWJj
14
+ NzJhMGFhZDg1YWMyNGM2ZmUxYTRiZjZlOWQxNzUwYTgzZGExNDJmOGVlZTQw
15
+ NzlhODNhZmRlZTlkMmNhMGQ0ZWNiM2U5ZWIyNmVlYTYyNWJiOTM=
@@ -10,30 +10,30 @@ module Consul
10
10
  # Public: Creates an instance of Consul::Model::Session with as many preset
11
11
  # defaults as possible.
12
12
  #
13
- # name - The name of the session.
14
- # lock_delay - Allowance window for leaders to Valid values between '0s' and '60s'
15
- # node - The name of the node, defaults to the node the agent is running on
16
- # checks - Health Checks to associate to this session
17
- # behaviour - 'release' or 'destroy' Behaviour when session is invalidated.
18
- # ttl - When provided Must be between '10s' and '3600s'
13
+ # Params -
14
+ # name - (Required) The name of the session.
15
+ # opts - (Optional) Options hash
16
+ # opts[:lock_delay] - Allowance window for leaders to Valid values between '0s' and '60s'
17
+ # opts[:node] - The name of the node, defaults to the node the agent is running on
18
+ # opts[:checks] - Health Checks to associate to this session
19
+ # opts[:behavior] - 'release' or 'destroy' Behaviour when session is invalidated.
20
+ # opts[:ttl] - When provided Must be between '10s' and '3600s'
19
21
  #
20
22
  # Returns: Consul::Model::Session instance.
21
- def self.for_name(name,
22
- lock_delay = '15s',
23
- node = nil,
24
- checks = ['serfHealth'],
25
- behaviour = 'release',
26
- ttl = nil)
23
+ def self.for_name(name, opts = {})
24
+ # lock_delay = '15s',
25
+ # node = nil,
26
+ # checks = ['serfHealth'],
27
+ # behaviour = 'release',
28
+ # ttl = nil)
27
29
  raise ArgumentError.new "Illegal Name: #{name}" if name.nil?
30
+ opts = {} if opts.nil?
28
31
  session = Consul::Model::Session.new(name: name)
29
- session.lock_delay = lock_delay unless lock_delay.nil?
30
- session.node = node unless node.nil?
31
- checks = [] if checks.nil?
32
- checks += 'serfHealth' unless checks.include? 'serfHealth'
33
- session.checks = checks
34
- behaviour = 'release' if behaviour.nil? or behaviour != 'release' or behaviour != 'destroy'
35
- session.behaviour = behaviour
36
- session.ttl = ttl unless ttl.nil?
32
+ session.lock_delay = opts[:lock_delay] unless opts.has_key?(:lock_delay)
33
+ session.node = opts[:node] unless opts.has_key?(:node)
34
+ session.checks = opts[:checks] if opts.has_key?(:checks)
35
+ session.behavior = opts[:behavior] if opts.has_key?(:behavior)
36
+ session.ttl = opts[:ttl] unless opts.has_key?(:ttl)
37
37
  session
38
38
  end
39
39
 
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Client
3
- VERSION = '0.0.9'
3
+ VERSION = '0.0.10'
4
4
  end
5
5
  end
@@ -16,7 +16,7 @@ module Consul
16
16
  property :name, as: :Name
17
17
  property :node, as: :Node
18
18
  collection :checks, as: :Checks
19
- property :behaviour, as: :Behavior
19
+ property :behavior, as: :Behavior
20
20
  property :ttl, as: :TTL
21
21
 
22
22
  # Properties that exclusively read access.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hotan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-04 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler