lib/ragoon/xml.rb in ragoon-0.5.2 vs lib/ragoon/xml.rb in ragoon-0.6.0

- old
+ new

@@ -1,11 +1,11 @@ module Ragoon::XML ACTION_PLACEHOLDER = '<!-- REQUEST_ACTION -->'.freeze BODY_PLACEHOLDER = '<!-- REQUEST_BODY -->'.freeze - def self.render(action_name, body_node) - template.dup. + def self.render(action_name, body_node, options) + template(options).dup. gsub!(ACTION_PLACEHOLDER, action_name). gsub!(BODY_PLACEHOLDER, body_node.to_xml) end def self.create_node(name, attributes = {}) @@ -14,11 +14,11 @@ node[key.to_s] = value end node end - def self.template + def self.template(options) <<"XML" <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" @@ -31,11 +31,11 @@ </Action> <Security xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" SOAP-ENV:mustUnderstand="1" xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext"> <UsernameToken wsu:Id="id"> - <Username>#{Ragoon.garoon_username}</Username> - <Password>#{Ragoon.garoon_password}</Password> + <Username>#{options[:username]}</Username> + <Password>#{options[:password]}</Password> </UsernameToken> </Security> <Timestamp SOAP-ENV:mustUnderstand="1" Id="id" xmlns="http://schemas.xmlsoap.org/ws/2002/07/utility"> <Created>#{Time.now.iso8601}</Created>