lib/securetrading/xml_doc.rb in securetrading-0.3.2 vs lib/securetrading/xml_doc.rb in securetrading-0.4.0
- old
+ new
@@ -1,10 +1,11 @@
module Securetrading
class XmlDoc
- def initialize(request_type, account_type)
+ def initialize(request_type, account_type, user = nil)
@account_type = account_type
@request_type = request_type
+ @user = user
end
def doc
return @doc if @doc.present?
@doc = Ox::Document.new(version: '1.0')
@@ -39,10 +40,10 @@
def new_element(name)
self.class.new_element(name)
end
def alias_el
- self.class.elements(alias: Securetrading.config.user).first
+ self.class.elements(alias: @user || Securetrading.config.user).first
end
def request_el
el = new_element('request')
el[:type] = @request_type