Class: KonoEppClient::Commands::UpdateDomain
- Defined in:
- lib/kono_epp_client/commands/update_domain.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ UpdateDomain
constructor
A new instance of UpdateDomain.
Constructor Details
#initialize(options) ⇒ UpdateDomain
Returns a new instance of UpdateDomain.
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/kono_epp_client/commands/update_domain.rb', line 3 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] or [:add_status] # <domain:add> domain_add = domain_update.add_element "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 if ns[1] host_addr = host_attr.add_element "domain:hostAddr", {"ip" => "v4"} host_addr.text = ns[1] end end end if [:add_admin] domain_contact = domain_add.add_element "domain:contact", {"type" => "admin"} domain_contact.text = [:add_admin] end if [:add_status] domain_add.add_element "domain:status", {"s" => [:add_status]} end if [:add_tech] domain_contact = domain_add.add_element "domain:contact", {"type" => "tech"} domain_contact.text = [:add_tech] end end if not [:remove_nameservers].blank? or [:remove_admin] or [:remove_tech] or [:remove_status] # <domain:rem> domain_remove = domain_update.add_element "domain:rem" unless [:remove_nameservers].blank? domain_remove_ns = domain_remove.add_element "domain:ns" [:remove_nameservers].each do |ns_name| host_attr = domain_remove_ns.add_element "domain:hostAttr" host_name = host_attr.add_element "domain:hostName" host_name.text = ns_name end end if [:remove_admin] domain_contact = domain_remove.add_element "domain:contact", {"type" => "admin"} domain_contact.text = [:remove_admin] end if [:remove_status] domain_remove.add_element "domain:status", {"s" => [:remove_status]} end if [:remove_tech] domain_contact = domain_remove.add_element "domain:contact", {"type" => "tech"} domain_contact.text = [:remove_tech] end 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 if [:restore] command.add_element("extension").tap do |ext| ext.add_element("rgp:update", {"xmlns:rgp" => "urn:ietf:params:xml:ns:rgp-1.0", "xsi:schemaLocation" => "urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd"}). add_element("rgp:restore", {"op" => "request"}) end end # TODO: Registrant if [:dns_sec_data] and [:dns_sec_data].any? extension = command.elements['extension'] || command.add_element("extension") create_list = extension.add_element("secDNS:update", {"xmlns:secDNS"=> "urn:ietf:params:xml:ns:secDNS-1.1"}) [:dns_sec_data].each do |d| create_list.add_element(d) end end end |