Sha256: e4197e810058c87e0b42921b2b82932492427f84a5b23102d72bc140156fb41c

Contents?: true

Size: 918 Bytes

Versions: 17

Compression:

Stored size: 918 Bytes

Contents

module GoogleApps
  module Atom
    class PublicKey
      def initialize
        @document = Atom::XML::Document.new
        add_header
      end
      
      # new_key adds the actual key to the PublicKey
      # XML document.
      #
      # new_key 'key'
      #
      # new_key returns @document.root
      def new_key(key)
        property = Atom::XML::Node.new('apps:property')
        property['name'] = 'publicKey'
        property['value'] = Base64.encode64 key

        @document.root << property
      end

      # to_s returns @document as a String
      def to_s
        @document.to_s
      end

      private

      def add_header
        @document.root = Atom::XML::Node.new('atom:entry')

        Atom::XML::Namespace.new(@document.root, 'atom', 'http://www.w3.org/2005/Atom')
        Atom::XML::Namespace.new(@document.root, 'apps', 'http://schemas.google.com/apps/2006')
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
google_apps-0.4.8.1 lib/google_apps/atom/public_key.rb
google_apps-0.4.8 lib/google_apps/atom/public_key.rb
google_apps-0.4.6 lib/google_apps/atom/public_key.rb
google_apps-0.4.5 lib/google_apps/atom/public_key.rb
google_apps-0.4.2 lib/google_apps/atom/public_key.rb
google_apps-0.4.1 lib/google_apps/atom/public_key.rb
google_apps-0.4 lib/google_apps/atom/public_key.rb
google_apps-0.3.12 lib/google_apps/atom/public_key.rb
google_apps-0.3.11 lib/google_apps/atom/public_key.rb
google_apps-0.3.10 lib/google_apps/atom/public_key.rb
google_apps-0.3.9 lib/google_apps/atom/public_key.rb
google_apps-0.3.8 lib/google_apps/atom/public_key.rb
google_apps-0.3.7 lib/google_apps/atom/public_key.rb
google_apps-0.3.6 lib/google_apps/atom/public_key.rb
google_apps-0.3.5 lib/google_apps/atom/public_key.rb
google_apps-0.3.4 lib/google_apps/atom/public_key.rb
google_apps-0.3.3 lib/google_apps/atom/public_key.rb