Class: NominetEPP::Domain::Create

Inherits:
Request
  • Object
show all
Defined in:
lib/nominet-epp/requests/domain/create.rb

Instance Attribute Summary

Attributes inherited from Request

#command, #extension

Instance Method Summary collapse

Methods inherited from Request

#command_name, #namespaces, #xml_namespace, #xml_node

Constructor Details

#initialize(name, options = {}) ⇒ Create

Returns a new instance of Create.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/nominet-epp/requests/domain/create.rb', line 4

def initialize(name, options = {})
  @name = name
  @options = options
  @namespaces = {}

  @extensions = @options.dup
  @extensions.delete_if { |k,_| !CreateExtension::KEYS.include?(k) }
  @options.delete_if    { |k,_|  CreateExtension::KEYS.include?(k) }

  @options[:auth_info] ||= {:pw => SecureRandom.hex(8) }

  @domain_ext = CreateExtension.new(@extensions) rescue nil
  @secdns_ext = CreateSecDNSExtension.new(@options.delete(:ds)) rescue nil

  validate_period(options[:period])

  @command    = EPP::Domain::Create.new(@name, @options)
  @extension  = EPP::Requests::Extension.new(@domain_ext, @secdns_ext) rescue nil
end