Module: NominetEPP::Operations::Check

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

Overview

EPP Check Operation

Instance Method Summary collapse

Instance Method Details

#check(*names) ⇒ false, ...

Check the availablity of one or more domain names

Parameters:

  • *names (String, ...)

    List of names to check

Returns:

  • (false)

    request failed

  • (true)

    the domain name is available

  • (Hash<String,Boolean>)

    availability by domain name



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nominet-epp/operations/check.rb', line 11

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

  return false unless @resp.success?

  @check_limit = check_abuse_limit(@resp.data)
  results = @resp.data.find('//domain:name', namespaces)
  if results.size > 1
    hash = {}
    results.each {|node| hash[node.content.strip] = (node['avail'] == '1') }
    hash
  else
    results.first['avail'] == '1'
  end
end