Method: GoogleApps::Atom::Node#create_node

Defined in:
lib/google_apps/atom/node.rb

#create_node(properties) ⇒ Object

create_node takes a hash of properties from which to build the XML node. The properties hash must have a :type key, it is also possible to pass an :attrs key with an array of attribute name, value pairs.

create_node type: ‘apps:property’, attrs: [[‘name’, ‘Tim’], [‘userName’, ‘[email protected]’]]

create_node returns an Atom::XML::Node with the specified properties.



14
15
16
17
18
19
20
# File 'lib/google_apps/atom/node.rb', line 14

def create_node(properties)
  if properties[:attrs]
    add_attributes Atom::XML::Node.new(properties[:type]), properties[:attrs]
  else
    Atom::XML::Node.new properties[:type]
  end
end