Class: RollCall::Node
- Inherits:
-
Object
- Object
- RollCall::Node
- Defined in:
- lib/roll_call/node.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#node_timeout ⇒ Object
Returns the value of attribute node_timeout.
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
-
#initialize(name, node_timeout, settings, url) ⇒ Node
constructor
A new instance of Node.
- #register ⇒ Object
- #unregister ⇒ Object
- #update(attributeIn) ⇒ Object
Constructor Details
#initialize(name, node_timeout, settings, url) ⇒ Node
Returns a new instance of Node.
8 9 10 11 12 13 |
# File 'lib/roll_call/node.rb', line 8 def initialize(name,node_timeout,settings,url) @name = name @node_timeout = node_timeout @settings = settings @url = url end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/roll_call/node.rb', line 6 def name @name end |
#node_timeout ⇒ Object
Returns the value of attribute node_timeout.
6 7 8 |
# File 'lib/roll_call/node.rb', line 6 def node_timeout @node_timeout end |
#settings ⇒ Object
Returns the value of attribute settings.
6 7 8 |
# File 'lib/roll_call/node.rb', line 6 def settings @settings end |
Instance Method Details
#register ⇒ Object
15 16 17 18 |
# File 'lib/roll_call/node.rb', line 15 def register payload = {service:{"name" => @name, "node_timeout" => @node_timeout, "settings" => @settings}} RestClient.post(@url,payload,accept: 'applciation/json') end |
#unregister ⇒ Object
20 21 22 |
# File 'lib/roll_call/node.rb', line 20 def unregister RestClient.delete(@url + @name) end |
#update(attributeIn) ⇒ Object
24 25 26 27 28 |
# File 'lib/roll_call/node.rb', line 24 def update(attributeIn) attribute = attributeIn payload = {service:attribute} RestClient.put(@url + @name,payload,accept: 'applciation/json') end |