Class: EPP::Domain::Update
- Defined in:
- lib/epp-client/domain/update.rb
Constant Summary collapse
- ADD_REM_ORDER =
[:ns, :contact, :status]
- CHG_ORDER =
[:registrant, :auth_info]
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.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/epp-client/domain/update.rb', line 11 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
22 23 24 |
# File 'lib/epp-client/domain/update.rb', line 22 def name 'update' end |
#to_xml ⇒ Object
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 54 55 56 |
# File 'lib/epp-client/domain/update.rb', line 26 def to_xml node = super node << domain_node('name', @name) unless @add.empty? node << add = domain_node('add') add_rem_to_xml(add, @add) end unless @rem.empty? node << rem = domain_node('rem') add_rem_to_xml(rem, @rem) end unless @chg.empty? node << chg = domain_node('chg') CHG_ORDER.each do |key| value = @chg[key] next if value.nil? case key when :registrant chg << domain_node('registrant', value) when :auth_info chg << auth_info_to_xml(value) end end end node end |