Module: NominetEPP::Operations::Fork

Included in:
Client
Defined in:
lib/nominet-epp/operations/fork.rb

Overview

EPP Fork Operation

Instance Method Summary collapse

Instance Method Details

#fork(account_num, *names) ⇒ false, Hash

Splits a selection of domains from one account into another.

The returned hash contains the following keys

  • (String) :roid – New account ID

  • (String) :name – New account name

  • (String) :crDate – Date the account was created

  • (Hash) :contact – Contact details

The :contact hash contains the following keys

  • (String) :roid – Contact ID

  • (String) :name – Contact Name

 - (String) :type – Contact Type

  • (Integer) :order – Contact Order

Parameters:

  • account_num (String)

    Account Number

  • *names (String, ...)

    Domain names to fork from the account

Returns:

  • (false)

    fork failed

  • (Hash)

    new account details



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
# File 'lib/nominet-epp/operations/fork.rb', line 23

def fork(, *names)
  @resp = @client.update do
    ('fork') do |node, ns|
      node << XML::Node.new('roid', , ns)
      names.each do |name|
        node << XML::Node.new('domain-name', name, ns)
      end
    end
  end

  return false unless @resp.success?

  hash = {
    :roid => node_value(@resp.data, '//account:creData/account:roid'),
    :name => node_value(@resp.data, '//account:creData/account:name'),
    :crDate => node_value(@resp.data, '//account:creData/account:crDate'),
    :contact => {
      :roid => node_value(@resp.data, '//account:creData/account:contact/contact:creData/contact:roid'),
      :name => node_value(@resp.data, '//account:creData/account:contact/contact:creData/contact:name')
    }
  }

  contact = @resp.data.find('//account:creData/account:contact', namespaces).first
  hash[:contact][:type] = contact['type']
  hash[:contact][:order] = contact['order']

  hash
end