lib/google_apps/atom/atom.rb in google_apps-0.4.5 vs lib/google_apps/atom/atom.rb in google_apps-0.4.6

- old
+ new

@@ -1,10 +1,31 @@ require 'libxml' require 'openssl' require 'base64' +class String + def camel_up + self.split('_').map(&:capitalize).join('') + end +end + module GoogleApps module Atom include LibXML + HASH_FUNCTION = "SHA-1" + DOCUMENTS = %w(user export group group_member message_attributes public_key) + + NAMESPACES = { + atom: 'http://www.w3.org/2005/Atom', + apps: 'http://schemas.google.com/apps/2006', + gd: 'http://schemas.google.com/g/2005' + } + + # The idea is to make document distribution more dynamic. + # Might be pointless but it's here for now. + DOCUMENTS.each do |doc| + eval "def #{doc}\n #{doc.camel_up}.new\nend" + module_function doc.to_sym + end end end \ No newline at end of file