Class: KonoEppCreateDomain

Inherits:
KonoEppCommand show all
Defined in:
lib/epp/epp_command/create_domain.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ KonoEppCreateDomain

Returns a new instance of KonoEppCreateDomain.



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
# File 'lib/epp/epp_command/create_domain.rb', line 2

def initialize( options )
  super( nil, nil )

  command = root.elements['command']
  create = command.add_element( "create" )


  domain_create = create.add_element( "domain:create", { "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_create.add_element "domain:name"
  name.text = options[:name]

  domain_ns = domain_create.add_element "domain:ns"

  options[:nameservers].each do |ns|
    host_attr = domain_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

  domain_registrant = domain_create.add_element "domain:registrant"
  domain_registrant.text = options[:registrant]

  domain_contact = domain_create.add_element "domain:contact", { "type" => "admin" }
  domain_contact.text = options[:admin]

  domain_contact = domain_create.add_element "domain:contact", { "type" => "tech" }
  domain_contact.text = options[:tech]

  domain_authinfo = domain_create.add_element "domain:authInfo"

  domain_pw = domain_authinfo.add_element "domain:pw"
  domain_pw.text = options[:authinfo]
end