Class: NominetEPP::CustomRequest
Instance Attribute Summary
Attributes inherited from Request
#extension
Instance Method Summary
collapse
Methods inherited from Request
#command_name, #xml_namespace, #xml_node
Instance Method Details
#command ⇒ Object
108
109
110
|
# File 'lib/nominet-epp/request.rb', line 108
def command
self
end
|
#namespace_name ⇒ Object
122
123
124
125
126
127
128
129
|
# File 'lib/nominet-epp/request.rb', line 122
def namespace_name
case namespace_uri
when /\Aurn\:/
namespace_uri.split(':').last.split('-',2).first.to_sym
else
namespace_uri.split('/').last.split('-')[0...-1].join('-').to_sym
end
end
|
#namespace_uri ⇒ Object
119
120
121
|
# File 'lib/nominet-epp/request.rb', line 119
def namespace_uri
raise NotImplementedError
end
|
#namespaces ⇒ Object
112
113
114
|
# File 'lib/nominet-epp/request.rb', line 112
def namespaces
@namespaces
end
|
#schema_name(urn) ⇒ String
Returns the name of the given schema
156
157
158
159
160
161
162
163
|
# File 'lib/nominet-epp/request.rb', line 156
def schema_name(urn)
case urn
when /\Aurn\:/
urn.split(':').last
else
urn.split('/').last
end
end
|
#schemaLocation ⇒ Object
131
132
133
|
# File 'lib/nominet-epp/request.rb', line 131
def schemaLocation
"#{namespace_uri} #{schema_name(namespace_uri)}.xsd"
end
|
#set_namespaces(namespaces) ⇒ Object
115
116
117
|
# File 'lib/nominet-epp/request.rb', line 115
def set_namespaces(namespaces)
@namespaces = namespaces
end
|
#x_namespace(node, name = namespace_name, ns = namespace_uri) ⇒ Object
142
143
144
145
|
# File 'lib/nominet-epp/request.rb', line 142
def x_namespace(node, name = namespace_name, ns = namespace_uri)
return @namespaces[name] if @namespaces.has_key?(name)
@namespaces[name] = xml_namespace(node, name, ns)
end
|
#x_node(name, value = nil) ⇒ Object
136
137
138
139
140
|
# File 'lib/nominet-epp/request.rb', line 136
def x_node(name, value = nil)
node = xml_node(name, value)
node.namespaces.namespace = x_namespace(node)
node
end
|
#x_schemaLocation(node, sL = schemaLocation) ⇒ Object
147
148
149
150
|
# File 'lib/nominet-epp/request.rb', line 147
def x_schemaLocation(node, sL = schemaLocation)
xattr = XML::Attr.new(node, "schemaLocation", sL)
xattr.namespaces.namespace = x_namespace(node, 'xsi', 'http://www.w3.org/2001/XMLSchema-instance')
end
|