Class: FioAPI::Payments::Xml::Root

Inherits:
Object
  • Object
show all
Defined in:
lib/base/payments/xml/root.rb

Constant Summary collapse

XSI_OPTIONS =
{
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
  'xsi:noNamespaceSchemaLocation' => 'http://www.fio.cz/schema/importIB.xsd'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payments) ⇒ Root



12
13
14
# File 'lib/base/payments/xml/root.rb', line 12

def initialize(payments)
  @payments = payments
end

Instance Attribute Details

#paymentsObject (readonly)

Returns the value of attribute payments.



10
11
12
# File 'lib/base/payments/xml/root.rb', line 10

def payments
  @payments
end

Instance Method Details

#buildObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/base/payments/xml/root.rb', line 16

def build
  @build ||= Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
    xml.Import(XSI_OPTIONS) do
      xml.Orders do
        payments.each do |payment|
          ::FioAPI::Payments::Xml::Item.new(xml, payment).build
        end
      end
    end
  end.to_xml
end