Class: EPP::Host::Update
- Defined in:
- lib/epp-client/host/update.rb
Constant Summary collapse
- ADD_REM_ORDER =
[:addr, :status]
- CHG_ORDER =
[:name]
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Update
constructor
A new instance of Update.
- #name ⇒ Object
- #to_xml ⇒ Object
Methods inherited from Command
Methods included from XMLHelpers
#as_xml, #epp_namespace, #epp_node, #xml_document, #xml_namespace, #xml_node
Constructor Details
#initialize(name, options = {}) ⇒ Update
Returns a new instance of Update.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/epp-client/host/update.rb', line 10 def initialize(name, = {}) @name = name @add = .delete(:add) || {} @rem = .delete(:rem) || {} @chg = .delete(:chg) || {} @add.delete_if { |k,_| !ADD_REM_ORDER.include?(k) } @rem.delete_if { |k,_| !ADD_REM_ORDER.include?(k) } @chg.delete_if { |k,_| !CHG_ORDER.include?(k) } end |
Instance Method Details
#name ⇒ Object
21 22 23 |
# File 'lib/epp-client/host/update.rb', line 21 def name 'update' end |
#to_xml ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/epp-client/host/update.rb', line 25 def to_xml node = super node << host_node('name', @name) unless @add.empty? node << add = host_node('add') add_rem_to_xml(add, @add) end unless @rem.empty? node << rem = host_node('rem') add_rem_to_xml(rem, @rem) end unless @chg.empty? node << chg = host_node('chg') CHG_ORDER.each do |key| value = @chg[key] next if value.nil? case key when :name chg << host_node('name', value) end end end node end |