Class: OpenPayU::XmlBuilder

Inherits:
Builder::XmlMarkup
  • Object
show all
Defined in:
lib/openpayu/xml_builder.rb

Instance Method Summary (collapse)

Constructor Details

- (XmlBuilder) initialize(req_type, options = {})

Returns a new instance of XmlBuilder



7
8
9
10
# File 'lib/openpayu/xml_builder.rb', line 7

def initialize(req_type, options = {})
  @req_type = req_type
  super(options)
end

Instance Method Details

- (Object) tag!(sym, *args, &block)



12
13
14
15
16
17
18
19
20
# File 'lib/openpayu/xml_builder.rb', line 12

def tag!(sym, *args, &block)
  if @level == 0 # Root element
    args << {
      'xsi:type' => @req_type,
      'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
    }
  end
  super(sym, *args, &block)
end