Class: NominetEPP::Domain::Update

Inherits:
Request
  • Object
show all
Defined in:
lib/nominet-epp/requests/domain/update.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, changes = {}) ⇒ Update

Returns a new instance of Update.



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

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

  extensions = (changes[:add] || {}).merge(changes[:chg] || {})
  extensions.delete_if { |k,_| !UpdateExtension::KEYS.include?(k) }

  changes[:add] && changes[:add].delete_if { |k,_| UpdateExtension::KEYS.include?(k) }
  changes[:rem] && changes[:rem].delete_if { |k,_| UpdateExtension::KEYS.include?(k) }
  changes[:chg] && changes[:chg].delete_if { |k,_| UpdateExtension::KEYS.include?(k) }

  dnssec = {}
  dnssec[:add] = changes[:add] && changes[:add].delete(:ds)
  dnssec[:rem] = changes[:rem] && changes[:rem].delete(:ds)
  dnssec[:chg] = changes[:chg] && changes[:chg].delete(:ds)

  @domain_ext = UpdateExtension.new(extensions) rescue nil
  @secdns_ext = UpdateSecDNSExtension.new(dnssec) rescue nil

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