lib/epics/sta.rb in epics-1.3.1 vs lib/epics/sta.rb in epics-1.4.0

- old
+ new

@@ -1,14 +1,22 @@ class Epics::STA < Epics::GenericRequest attr_accessor :from, :to - def initialize(client, from, to) + def initialize(client, from = nil, to = nil) 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, @@ -21,15 +29,10 @@ :content! => "EPICS - a ruby ebics kernel" }, "OrderDetails" => { "OrderType" => "STA", "OrderAttribute" => "DZHNN", - "StandardOrderParams" => { - "DateRange" => { - "Start" => from, - "End" => to - } - } + "StandardOrderParams" => date_range }, "BankPubKeyDigests" => { "Authentication" => { :@Version => "X002", :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",