Class: Arbetsformedlingen::PacketXMLBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/arbetsformedlingen/models/packet_xml_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(packet) ⇒ PacketXMLBuilder

Returns a new instance of PacketXMLBuilder.



7
8
9
# File 'lib/arbetsformedlingen/models/packet_xml_builder.rb', line 7

def initialize(packet)
  @packet = packet
end

Instance Method Details

#to_xmlObject



11
12
13
14
15
16
17
# File 'lib/arbetsformedlingen/models/packet_xml_builder.rb', line 11

def to_xml
  @xml ||= begin
    # TODO: Set option so that åäö isn't encoded
    builder = Builder::XmlMarkup.new(indent: 2)
    append_envelope(builder, @packet.to_h)
  end
end