6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/emarsys/broadcast/batch_xml_builder.rb', line 6
def build(batch)
raise ArgumentError, 'batch is required' unless batch
builder = Nokogiri::XML::Builder.new do |xml|
xml.batch {
xml.name batch.name
xml.runDate format_time(batch.send_time)
xml.properties {
xml.property(key: :Sender){xml.text batch.sender_id}
xml.property(key: :Language){xml.text 'en'}
xml.property(key: :Encoding){xml.text 'UTF-8'}
xml.property(key: :Domain){xml.text batch.sender_domain}
xml.property(key: :ImportDelay){xml.text batch.import_delay_hours}
}
xml.subject batch.subject
xml.html batch.body_html
xml.text batch.body_text
}
end
builder.to_xml
end
|