Class: Reactor::Cm::Attribute
- Inherits:
-
Object
- Object
- Reactor::Cm::Attribute
- Defined in:
- lib/reactor/cm/attribute.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create(name, type) ⇒ Object
19 20 21 22 23 |
# File 'lib/reactor/cm/attribute.rb', line 19 def self.create(name, type) attr = Attribute.new attr.send(:create,name,type) attr end |
.exists?(name) ⇒ Boolean
5 6 7 8 9 10 11 |
# File 'lib/reactor/cm/attribute.rb', line 5 def self.exists?(name) begin return Attribute.new.send(:get,name).ok? rescue return false end end |
.get(name) ⇒ Object
13 14 15 16 17 |
# File 'lib/reactor/cm/attribute.rb', line 13 def self.get(name) attr = Attribute.new attr.send(:get,name) attr end |
Instance Method Details
#delete! ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/reactor/cm/attribute.rb', line 41 def delete! request = XmlRequest.prepare do |xml| xml.where_key_tag!(base_name, 'name', @name) xml.tag!("#{base_name}-delete") end response = request.execute! end |
#save! ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/reactor/cm/attribute.rb', line 29 def save! request = XmlRequest.prepare do |xml| xml.where_key_tag!(base_name, 'name', @name) xml.set_tag!(base_name) do @params.each do |key, value| xml.value_tag!(key.to_s, value) end end end response = request.execute! end |
#set(key, value) ⇒ Object
25 26 27 |
# File 'lib/reactor/cm/attribute.rb', line 25 def set(key, value) @params[key.to_sym] = value end |