Sha256: 2bd47756c7bd639d14bb643c06568fe36c6297647d8f37da630faa6cbb571faa

Contents?: true

Size: 728 Bytes

Versions: 4

Compression:

Stored size: 728 Bytes

Contents

module GoogleApps
  module Atom
    class PublicKey
      include Atom::Node
      include Atom::Document

      attr_reader :document

      def initialize
        @document = Atom::XML::Document.new
        @document.root = build_root
      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
google_apps-0.4.9.9 lib/google_apps/atom/public_key.rb
google_apps-0.4.9.2 lib/google_apps/atom/public_key.rb
google_apps-0.4.9.1 lib/google_apps/atom/public_key.rb
google_apps-0.4.9 lib/google_apps/atom/public_key.rb