Class: KonoEppUpdateDomain
- Inherits:
-
KonoEppCommand
- Object
- REXML::Document
- KonoEppCommand
- KonoEppUpdateDomain
- Defined in:
- lib/epp/epp_command/update_domain.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ KonoEppUpdateDomain
constructor
A new instance of KonoEppUpdateDomain.
Constructor Details
#initialize(options) ⇒ KonoEppUpdateDomain
Returns a new instance of KonoEppUpdateDomain.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/epp/epp_command/update_domain.rb', line 2 def initialize( ) super( nil, nil ) command = root.elements['command'] update = command.add_element( "update" ) domain_update = update.add_element( "domain:update", { "xmlns:domain" => "urn:ietf:params:xml:ns:domain-1.0", "xsi:schemaLocation" => "urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd" } ) name = domain_update.add_element "domain:name" name.text = [:name] if not [:add_nameservers].blank? or [:add_admin] or [:add_tech] domain_add = domain_update.add_element "domain:add" end if not [:remove_nameservers].blank? or [:remove_admin] or [:remove_tech] domain_remove = domain_update.add_element "domain:rem" end # <domain:add> unless [:add_nameservers].blank? domain_add_ns = domain_add.add_element "domain:ns" [:add_nameservers].each do |ns| host_attr = domain_add_ns.add_element "domain:hostAttr" host_name = host_attr.add_element "domain:hostName" host_name.text = ns[0] # FIXME IPv6 host_addr = host_attr.add_element "domain:hostAddr", { "ip" => "v4" } host_addr.text = ns[1] end end if [:add_admin] domain_contact = domain_add.add_element "domain:contact", { "type" => "admin" } domain_contact.text = [:add_admin] end if [:add_tech] domain_contact = domain_add.add_element "domain:contact", { "type" => "tech" } domain_contact.text = [:add_tech] end # <domain:rem> unless [:remove_nameservers].blank? domain_remove_ns = domain_remove.add_element "domain:ns" [:remove_nameservers].each do |name| host_attr = domain_remove_ns.add_element "domain:hostAttr" host_name = host_attr.add_element "domain:hostName" host_name.text = name end end if [:remove_admin] domain_contact = domain_remove.add_element "domain:contact", { "type" => "admin" } domain_contact.text = [:remove_admin] end if [:remove_tech] domain_contact = domain_remove.add_element "domain:contact", { "type" => "tech" } domain_contact.text = [:remove_tech] end # <domain:chg> if [:auth_info] domain_change = domain_update.add_element "domain:chg" if [:registrant] domain_registrant = domain_change.add_element "domain:registrant" domain_registrant.text = [:registrant] end domain_authinfo = domain_change.add_element "domain:authInfo" domain_pw = domain_authinfo.add_element "domain:pw" domain_pw.text = [:auth_info] end # TODO: Registrant end |