lib/google_apps/atom/nickname.rb in google_apps-0.4.6 vs lib/google_apps/atom/nickname.rb in google_apps-0.4.8
- old
+ new
@@ -1,9 +1,11 @@
module GoogleApps
module Atom
class Nickname
- include GoogleApps::Atom::Node
+ include Atom::Node
+ include Atom::Document
+
attr_reader :nickname, :user, :document
ELEMENTS = { nick: ['apps:nickname', 'name'], user: ['apps:login', 'userName'] }
def initialize
@@ -46,27 +48,18 @@
# header returns an atom:entry node with the appropriate
# namespaces for a GoogleApps nickname document
def header
- node = Atom::XML::Node.new('atom:entry')
-
- Atom::XML::Namespace.new(node, 'atom', 'http://www.w3.org/2005/Atom')
- Atom::XML::Namespace.new(node, 'apps', 'http://schemas.google.com/apps/2006')
-
- node
+ add_namespaces create_node(type: 'atom:entry'), atom: 'http://www.w3.org/2005/Atom', apps: 'http://schemas.google.com/apps/2006'
end
# category constructs an atom:category node with the
# appropriate attributes for a GoogleApps nickname
# document.
def category
- node = Atom::XML::Node.new('atom:category')
- node.attributes['scheme'] = 'http://schemas.google.com/g/2005#kind'
- node.attributes['term'] = 'http://schemas.google.com/apps/2006#nickname'
-
- node
+ create_node type: 'atom:category', attrs: Atom::CATEGORY[:nickname]
end
# set_nickname adds an apps:nickname node to the
# underlying XML document and sets @nickname.
\ No newline at end of file