Class: GoogleApps::Atom::PublicKey

Inherits:
Document
  • Object
show all
Defined in:
lib/google_apps/atom/public_key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Document

add_type, #attrs_from_props, #build_root, #delete_node, #determine_namespaces, #find_and_update, #find_values, inherited, #make_document, #new_empty_doc, #parse, #set_instances, sub_to_meth, #type_to_s, #type_to_sym, types

Methods included from Node

#add_attributes, #add_namespaces, #add_prop_node, #check_value, #create_node, #get_content, #get_values, #node_match?

Constructor Details

#initializePublicKey

Returns a new instance of PublicKey.



6
7
8
9
# File 'lib/google_apps/atom/public_key.rb', line 6

def initialize
  super(nil)
  @doc.root = build_root :publickey
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



4
5
6
# File 'lib/google_apps/atom/public_key.rb', line 4

def doc
  @doc
end

Instance Method Details

#new_key(key) ⇒ Object

new_key adds the actual key to the PublicKey XML document.

new_key ‘key’

new_key returns @doc.root



17
18
19
20
21
22
23
# File 'lib/google_apps/atom/public_key.rb', line 17

def new_key(key)
  property = Atom::XML::Node.new('apps:property')
  property['name'] = 'publicKey'
  property['value'] = Base64.encode64 key

  @doc.root << property
end

#to_sObject

to_s returns @doc as a String



26
27
28
# File 'lib/google_apps/atom/public_key.rb', line 26

def to_s
  @doc.to_s
end