Class: Velocity::Instance::Repository
- Defined in:
- lib/acceleration/velocity.rb
Overview
Repository models an instance’s configuration node repository, enabling a user to list, download, update, add, and delete configuration nodes.
Create a new wrapper for the repository management functions. The following methods are handled via method_missing and are thus documented here.
-
add(:node => xml)
- Add a node to the repository. -
delete(:element => element, :name => name, :md5 => md5)
- Delete a node from the repository.:md5
is optional. -
get(:element => element, :name => name)
- Get a node from the repository. -
get_md5(:element => element, :name => name)
- Get a node with its md5 hash from the repository. -
list_xml()
- List the xml nodes in the repository. -
update(:node => xml, :md5 => md5)
- Update a node that is already in the repository.:md5
is optional.
Any return value will be raw Nokogiri::XML::Document
object.
Instance Attribute Summary
Attributes inherited from APIModel
Instance Method Summary collapse
-
#get_nodespec(nodespec) ⇒ Object
Get a node given its nodespec in the form element.@name.
-
#list_xml_specs(internal = false) ⇒ Object
List all nodes as nodespecs.
-
#prefix ⇒ Object
The Repository prefix is simply
repository
.
Methods inherited from APIModel
#initialize, #method_missing, #resolve, #respond_to_missing?
Constructor Details
This class inherits a constructor from Velocity::Instance::APIModel
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Velocity::Instance::APIModel
Instance Method Details
#get_nodespec(nodespec) ⇒ Object
Get a node given its nodespec in the form element.@name
576 577 578 579 |
# File 'lib/acceleration/velocity.rb', line 576 def get_nodespec(nodespec) element, name = nodespec.split '.' get element: element, name: name end |
#list_xml_specs(internal = false) ⇒ Object
List all nodes as nodespecs
564 565 566 567 568 569 570 571 572 573 |
# File 'lib/acceleration/velocity.rb', line 564 def list_xml_specs(internal = false) arr = [] xml = list_xml xml.child.children.each do |c| if !c.has_attribute?('internal') || (c.has_attribute?('internal') && internal) arr << '%s.%s'.format([c.name, c.attr('name')]) end end arr end |
#prefix ⇒ Object
The Repository prefix is simply repository
.
559 560 561 |
# File 'lib/acceleration/velocity.rb', line 559 def prefix 'repository' end |