Class: EPP::Requests::Command

Inherits:
Abstract
  • Object
show all
Defined in:
lib/epp-client/requests/command.rb

Instance Attribute Summary

Attributes inherited from Abstract

#namespaces

Instance Method Summary collapse

Methods inherited from Abstract

#set_namespaces, #to_s

Methods included from XMLHelpers

#as_xml, #epp_namespace, #epp_node, #xml_document, #xml_namespace, #xml_node

Constructor Details

#initialize(tid, command, extension = nil) ⇒ Command

Returns a new instance of Command.



6
7
8
# File 'lib/epp-client/requests/command.rb', line 6

def initialize(tid, command, extension = nil)
  @tid, @command, @extension = tid, command, extension
end

Instance Method Details

#nameObject



10
11
12
# File 'lib/epp-client/requests/command.rb', line 10

def name
  'command'
end

#to_xmlObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/epp-client/requests/command.rb', line 14

def to_xml
  node = super

  @command.set_namespaces(@namespaces) if @command.respond_to?(:set_namespaces)
  @extension.set_namespaces(@namespaces) if @extension && @extension.respond_to?(:set_namespaces)

  node << as_xml(@command)
  node << as_xml(@extension) if @extension
  node << epp_node('clTRID', @tid, @namespaces)

  node
end