class XmlPayload::XmlGenerator

Public Class Methods

add_attributes( node, attributes ) click to toggle source
# File lib/valuefirst/xml_payload/xml_generator.rb, line 10
def self.add_attributes( node, attributes )
  attributes.each do |name, value|
    XML::Attr.new( node, name, value )
  end
end
create_node( name, options = {} ) click to toggle source
# File lib/valuefirst/xml_payload/xml_generator.rb, line 16
def self.create_node( name, options = {} )
  node = XML::Node.new( name )
  
  attributes = options.delete( :attributes ) unless options.empty?
  add_attributes( node, attributes ) if attributes
  
  node
end
new_doc() click to toggle source
# File lib/valuefirst/xml_payload/xml_generator.rb, line 4
def self.new_doc
  doc = XML::Document.new
  doc.encoding = XML::Encoding::ISO_8859_1
  doc
end
user_tag(vfirst_config) click to toggle source
# File lib/valuefirst/xml_payload/xml_generator.rb, line 25
def self.user_tag vfirst_config
  XmlPayload::XmlGenerator.create_node("USER", attributes: {"USERNAME" => vfirst_config.username.to_s, "PASSWORD" => vfirst_config.password.to_s})
end