Class: EPP::Requests::Extension

Inherits:
Abstract
  • Object
show all
Defined in:
lib/epp-client/requests/extension.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(*extensions) ⇒ Extension

Returns a new instance of Extension.

Raises:

  • (ArgumentError)


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

def initialize(*extensions)
  raise ArgumentError, "you must provide at least one extension" if extensions.compact.empty?
  @extensions = extensions.compact
end

Instance Method Details

#nameObject



11
12
13
# File 'lib/epp-client/requests/extension.rb', line 11

def name
  'extension'
end

#to_xmlObject



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

def to_xml
  node = super

  Array(@extensions).each do |extension|
    next if extension.nil?
    extension.set_namespaces(@namespaces) if extension.respond_to?(:set_namespaces)
    node << as_xml(extension)
  end

  node
end