Module: JytPay::Xml
- Defined in:
- lib/jyt_pay/xml/xml.rb
Defined Under Namespace
Classes: MyPrecious
Class Method Summary collapse
Class Method Details
.generate(merchant_id, trans_code, param_hash, flow_id) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/jyt_pay/xml/xml.rb', line 5 def self.generate(merchant_id, trans_code, param_hash, flow_id) prefix = %q[<?xml version="1.0" encoding="UTF-8"?>] doc = ::REXML::Document.new "<message />" header = gen_header(merchant_id, trans_code, flow_id) body = gen_body(param_hash) doc.root.add(header) doc.root.add(body) r = "" printer = MyPrecious.new(5) printer.width = 1000 printer.compact = true printer.write(doc, r) "#{prefix}\n#{r}" end |