Class: NominetEPP::Contact::CreateExtension
Constant Summary
collapse
- KEYS =
[:trad_name, :type, :co_no, :opt_out]
- NAMESPACE =
'http://www.nominet.org.uk/epp/xml/contact-nom-ext-1.0'
Instance Attribute Summary
#namespaces
Instance Method Summary
collapse
#schemaLocation, #schema_name, #set_namespaces, #x_namespace, #x_node, #x_schemaLocation, #xml_namespace, #xml_node
Constructor Details
Returns a new instance of CreateExtension.
26
27
28
29
30
|
# File 'lib/nominet-epp/requests/contact/create.rb', line 26
def initialize(attributes)
raise ArgumentError, "must provide Hash of #{KEYS.map(&:inspect).join(", ")}" if attributes.nil? || attributes.empty?
@attributes = attributes
@namespaces = {}
end
|
Instance Method Details
#namespace_name ⇒ Object
35
36
37
|
# File 'lib/nominet-epp/requests/contact/create.rb', line 35
def namespace_name
'contact-ext'
end
|
#namespace_uri ⇒ Object
32
33
34
|
# File 'lib/nominet-epp/requests/contact/create.rb', line 32
def namespace_uri
NAMESPACE
end
|
#to_xml ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/nominet-epp/requests/contact/create.rb', line 39
def to_xml
node = x_node('create')
x_schemaLocation(node)
KEYS.each do |key|
value = @attributes[key]
next if value.nil? || value == ''
case key
when :opt_out
node << x_node('opt-out', value ? 'Y' : 'N')
else
name = key.to_s.gsub('_', '-')
node << x_node(name, value.to_s)
end
end
node
end
|