Module: Spice::Connection::Nodes
- Included in:
- Spice::Connection
- Defined in:
- lib/spice/connection/nodes.rb
Instance Method Summary collapse
- #create_node(params = Mash.new) ⇒ Object
-
#node(name) ⇒ Spice::Node
(also: #get_node)
Retrieve a single client.
-
#nodes(options = Mash.new) ⇒ Array<Spice::Node>
A collection of nodes.
-
#update_node(params = Mash.new) ⇒ Object
def create_node.
Instance Method Details
#create_node(params = Mash.new) ⇒ Object
29 30 31 32 33 |
# File 'lib/spice/connection/nodes.rb', line 29 def create_node(params=Mash.new) node = Spice::Node.new(params) post("/nodes", node.attrs) get_node(node.name) end |
#node(name) ⇒ Spice::Node Also known as: get_node
Retrieve a single client
22 23 24 25 |
# File 'lib/spice/connection/nodes.rb', line 22 def node(name) attributes = get("/nodes/#{name}") Spice::Node.get_or_new(attributes) end |
#nodes(options = Mash.new) ⇒ Array<Spice::Node>
A collection of nodes
12 13 14 |
# File 'lib/spice/connection/nodes.rb', line 12 def nodes(=Mash.new) search('node', ) end |
#update_node(params = Mash.new) ⇒ Object
def create_node
35 36 37 38 39 40 |
# File 'lib/spice/connection/nodes.rb', line 35 def update_node(params=Mash.new) node = get_node(params[:name]) node.attrs.update Spice::Node.new(params) put("/nodes/#{node.name}", node.attrs) get_node(node.name) end |