Sha256: 5f0777ab64b0b41a39b777c07cfb9696162ec73b4419172ca0b3c3f6cf3249a1

Contents?: true

Size: 723 Bytes

Versions: 3

Compression:

Stored size: 723 Bytes

Contents

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

        @document.root << property
      end

      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

3 entries across 3 versions & 1 rubygems

Version Path
google_apps-0.3.2 lib/google_apps/atom/public_key.rb
google_apps-0.3.1 lib/google_apps/atom/public_key.rb
google_apps-0.3.0 lib/google_apps/atom/public_key.rb