lib/epics/sta.rb in epics-1.5.1 vs lib/epics/sta.rb in epics-1.5.2
- old
+ new
@@ -5,51 +5,42 @@
super(client)
self.from = from
self.to = to
end
- def date_range
- if !!from && !!to
- { "DateRange" => { "Start" => from, "End" => to } }
- else
- { :content! => '' }
- end
- end
-
def header
- {
- :@authenticate => true,
- static: {
- "HostID" => host_id,
- "Nonce" => nonce,
- "Timestamp" => timestamp,
- "PartnerID" => partner_id,
- "UserID" => user_id,
- "Product" => {
- :@Language => "de",
- :content! => "EPICS - a ruby ebics kernel"
- },
- "OrderDetails" => {
- "OrderType" => "STA",
- "OrderAttribute" => "DZHNN",
- "StandardOrderParams" => date_range
- },
- "BankPubKeyDigests" => {
- "Authentication" => {
- :@Version => "X002",
- :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
- :content! => client.bank_x.public_digest
- },
- "Encryption" => {
- :@Version => "E002",
- :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
- :content! => client.bank_e.public_digest
+ Nokogiri::XML::Builder.new do |xml|
+ xml.header(authenticate: true) {
+ xml.static {
+ xml.HostID host_id
+ xml.Nonce nonce
+ xml.Timestamp timestamp
+ xml.PartnerID partner_id
+ xml.UserID user_id
+ xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
+ xml.OrderDetails {
+ xml.OrderType 'STA'
+ xml.OrderAttribute 'DZHNN'
+ if !!from && !!to
+ xml.StandardOrderParams {
+ xml.DateRange {
+ xml.Start from
+ xml.End to
+ }
+ }
+ else
+ xml.StandardOrderParams
+ end
}
- },
- "SecurityMedium" => "0000"
- },
- "mutable" => {
- "TransactionPhase" => "Initialisation"
+ xml.BankPubKeyDigests {
+ xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
+ xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
+ }
+ xml.SecurityMedium '0000'
+ }
+ xml.mutable {
+ xml.TransactionPhase 'Initialisation'
+ }
}
- }
+ end.doc.root
end
end