Class: EPP::Request
- Inherits:
-
Object
- Object
- EPP::Request
- Includes:
- XMLHelpers
- Defined in:
- lib/epp-client/request.rb
Overview
An EPP XML Request
Instance Method Summary collapse
-
#initialize(request) ⇒ Request
constructor
Create and return a new EPP Request Payload.
- #namespaces ⇒ Object
-
#to_s(opts = {}) ⇒ Object
Convert the receiver to a string.
-
#to_xml ⇒ XML::Document
Receiver in XML form.
Methods included from XMLHelpers
#as_xml, #epp_namespace, #epp_node, #xml_document, #xml_namespace, #xml_node
Constructor Details
#initialize(request) ⇒ Request
Create and return a new EPP Request Payload
9 10 11 |
# File 'lib/epp-client/request.rb', line 9 def initialize(request) @request = request end |
Instance Method Details
#namespaces ⇒ Object
13 14 15 |
# File 'lib/epp-client/request.rb', line 13 def namespaces @namespaces end |
#to_s(opts = {}) ⇒ Object
Convert the receiver to a string
42 43 44 |
# File 'lib/epp-client/request.rb', line 42 def to_s(opts = {}) to_xml.to_s({:indent => false}.merge(opts)) end |
#to_xml ⇒ XML::Document
Receiver in XML form
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/epp-client/request.rb', line 19 def to_xml doc = XML::Document.new('1.0') doc.root = XML::Node.new('epp') root = doc.root epp_ns = XML::Namespace.new(root, nil, 'urn:ietf:params:xml:ns:epp-1.0') root.namespaces.namespace = epp_ns xsi_ns = XML::Namespace.new(root, 'xsi', 'http://www.w3.org/2001/XMLSchema-instance') xsi_sL = XML::Attr.new(root, 'schemaLocation', 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') xsi_sL.namespaces.namespace = xsi_ns @namespaces = {'epp' => epp_ns, 'xsi' => xsi_ns} @request.set_namespaces(@namespaces) if @request.respond_to?(:set_namespaces) root << @request.to_xml doc end |