Class: XmlPayload::XmlGenerator
- Inherits:
-
Object
- Object
- XmlPayload::XmlGenerator
- Defined in:
- lib/valuefirst/xml_payload/xml_generator.rb
Class Method Summary collapse
- .add_attributes(node, attributes) ⇒ Object
- .create_node(name, options = {}) ⇒ Object
- .new_doc ⇒ Object
- .user_tag(vfirst_config) ⇒ Object
Class Method Details
.add_attributes(node, attributes) ⇒ Object
10 11 12 13 14 |
# 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 = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/valuefirst/xml_payload/xml_generator.rb', line 16 def self.create_node( name, = {} ) node = XML::Node.new( name ) attributes = .delete( :attributes ) unless .empty? add_attributes( node, attributes ) if attributes node end |
.new_doc ⇒ Object
4 5 6 7 8 |
# 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) ⇒ Object
25 26 27 |
# 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 |