Class: GoogleAppsApi::Provisioning::Api
- Defined in:
- lib/google_apps_api/provisioning.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Attributes inherited from BaseApi
Instance Method Summary collapse
- #create_user(username, *args) ⇒ Object
- #delete_user(username, *args) ⇒ Object
-
#initialize(*args) ⇒ Api
constructor
A new instance of Api.
- #retrieve_all_users(*args) ⇒ Object
- #retrieve_user(user, *args) ⇒ Object
- #update_user(username, *args) ⇒ Object
Methods inherited from BaseApi
Constructor Details
#initialize(*args) ⇒ Api
Returns a new instance of Api.
9 10 11 |
# File 'lib/google_apps_api/provisioning.rb', line 9 def initialize(*args) super(:provisioning, *args) end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
6 7 8 |
# File 'lib/google_apps_api/provisioning.rb', line 6 def token @token end |
Instance Method Details
#create_user(username, *args) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/google_apps_api/provisioning.rb', line 27 def create_user(username, *args) = args. .each { |k,v| [k] = escapeXML(v)} res = " <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n xmlns:apps=\"http://schemas.google.com/apps/2006\">\n <atom:category scheme=\"http://schemas.google.com/g/2005#kind\" \n term=\"http://schemas.google.com/apps/2006#user\"/>\n <apps:login userName=\"\#{escapeXML(username)}\" \n password=\"\#{options[:password]}\" suspended=\"false\"/>\n <apps:name familyName=\"\#{options[:family_name]}\" givenName=\"\#{options[:given_name]}\"/>\n </atom:entry>\n\n DESCXML\n\n\n request(:create_user, options.merge(:body => res.strip))\nend\n" |
#delete_user(username, *args) ⇒ Object
67 68 69 70 |
# File 'lib/google_apps_api/provisioning.rb', line 67 def delete_user(username, *args) = args..merge(:username => username) request(:delete_user, ) end |
#retrieve_all_users(*args) ⇒ Object
21 22 23 24 |
# File 'lib/google_apps_api/provisioning.rb', line 21 def retrieve_all_users(*args) = args. request(:retrieve_all_users, ) end |
#retrieve_user(user, *args) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/google_apps_api/provisioning.rb', line 13 def retrieve_user(user, *args) username = user.kind_of?(UserEntity) ? user.id : user = args..merge(:username => username) request(:retrieve_user, ) end |
#update_user(username, *args) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/google_apps_api/provisioning.rb', line 49 def update_user(username, *args) = args. .each { |k,v| [k] = escapeXML(v)} res = " <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n xmlns:apps=\"http://schemas.google.com/apps/2006\">\n <atom:category scheme=\"http://schemas.google.com/g/2005#kind\" \n term=\"http://schemas.google.com/apps/2006#user\"/>\n <apps:name familyName=\"\#{options[:family_name]}\" givenName=\"\#{options[:given_name]}\"/>\n </atom:entry>\n\n DESCXML\n request(:update_user, options.merge(:username => username, :body => res.strip))\nend\n" |