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

- old
+ new

@@ -11,21 +11,46 @@ 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' + gd: 'http://schemas.google.com/g/2005', + openSearch: 'http://a9.com/-/spec/opensearchrss/1.0/' } + MAPS = { + user: { + userName: :login, + suspended: :suspended, + familyName: :last_name, + givenName: :first_name, + limit: :quota, + password: :password + }, + nickname: { + name: :nickname, + userName: :user + } + } + + CATEGORY = { + user: [['scheme', 'http://schemas.google.com/g/2005#kind'], ['term', 'http://schemas.google.com/apps/2006#user']], + nickname: [['scheme', 'http://schemas.google.com/g/2005#kind'], ['term', 'http://schemas.google.com/apps/2006#nickname']], + group: [['scheme', 'http://schemas.google.com/g/2005#kind'], ['term', 'http://schemas.google.com/apps/2006#group']] + } + + ENTRY_TAG = ["<atom:entry xmlns:atom=\"#{NAMESPACES[:atom]}\" xmlns:apps=\"#{NAMESPACES[:apps]}\" xmlns:gd=\"#{NAMESPACES[:gd]}\">", '</atom:entry>'] + + DOCUMENTS = %w(user export group group_member message_attributes public_key feed) + # 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" + eval "def #{doc}(*args)\n #{doc.camel_up}.new *args\nend" # Needs __file__ and __line__ module_function doc.to_sym end end end \ No newline at end of file