Class: GAppsProvisioning::RequestMessage
- Inherits:
-
Document
- Object
- Document
- GAppsProvisioning::RequestMessage
- Defined in:
- lib/provisioning-api.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#about_email_list(email_list) ⇒ Object
adds <apps:emailList> element in the message body.
-
#about_group(group_id, properties) ⇒ Object
adds <apps:property> element in the message body for a group.
-
#about_login(user_name, passwd = nil, hash_function_name = nil, admin = nil, suspended = nil, change_passwd_at_next_login = nil) ⇒ Object
adds <apps:login> element in the message body.
-
#about_member(email_address) ⇒ Object
adds <apps:property> element in the message body for a member.
-
#about_name(family_name, given_name) ⇒ Object
adds <apps:name> in the message body.
-
#about_nickname(name) ⇒ Object
adds <apps:nickname> in the message body.
-
#about_owner(email_address) ⇒ Object
adds <apps:property> element in the message body for an owner.
-
#about_quota(limit) ⇒ Object
adds <apps:quota> in the message body.
-
#about_who(email) ⇒ Object
adds <gd:who> in the message body.
-
#add_path(url) ⇒ Object
adds <atom:id> element in the message body.
-
#initialize ⇒ RequestMessage
constructor
creates the object and initiates the construction.
Constructor Details
#initialize ⇒ RequestMessage
creates the object and initiates the construction
797 798 799 800 801 802 803 |
# File 'lib/provisioning-api.rb', line 797 def initialize super '<?xml version="1.0" encoding="UTF-8"?>' self.add_element "atom:entry", {"xmlns:apps" => "http://schemas.google.com/apps/2006", "xmlns:gd" => "http://schemas.google.com/g/2005", "xmlns:atom" => "http://www.w3.org/2005/Atom"} self.elements["atom:entry"].add_element "atom:category", {"scheme" => "http://schemas.google.com/g/2005#kind"} end |
Instance Method Details
#about_email_list(email_list) ⇒ Object
adds <apps:emailList> element in the message body.
812 813 814 815 |
# File 'lib/provisioning-api.rb', line 812 def about_email_list(email_list) self.elements["atom:entry/atom:category"].add_attribute("term", "http://schemas.google.com/apps/2006#emailList") self.elements["atom:entry"].add_element "apps:emailList", {"name" => email_list } end |
#about_group(group_id, properties) ⇒ Object
adds <apps:property> element in the message body for a group.
818 819 820 821 822 823 824 |
# File 'lib/provisioning-api.rb', line 818 def about_group(group_id, properties) self.elements["atom:entry/atom:category"].add_attribute("term", "http://schemas.google.com/apps/2006#emailList") self.elements["atom:entry"].add_element "apps:property", {"name" => "groupId", "value" => group_id } self.elements["atom:entry"].add_element "apps:property", {"name" => "groupName", "value" => properties[0] } self.elements["atom:entry"].add_element "apps:property", {"name" => "description", "value" => properties[1] } self.elements["atom:entry"].add_element "apps:property", {"name" => "emailPermission", "value" => properties[2] } end |
#about_login(user_name, passwd = nil, hash_function_name = nil, admin = nil, suspended = nil, change_passwd_at_next_login = nil) ⇒ Object
adds <apps:login> element in the message body. warning : if valued admin, suspended, or change_passwd_at_next_login must be the STRINGS “true” or “false”, not the boolean true or false when needed to construct the message, should always been used before other “about_” methods so that the category tag can be overwritten only values permitted for hash_function_function_name : “SHA-1”, “MD5” or nil
843 844 845 846 847 848 849 850 851 852 |
# File 'lib/provisioning-api.rb', line 843 def about_login(user_name, passwd=nil, hash_function_name=nil, admin=nil, suspended=nil, change_passwd_at_next_login=nil) self.elements["atom:entry/atom:category"].add_attribute("term", "http://schemas.google.com/apps/2006#user") self.elements["atom:entry"].add_element "apps:login", {"userName" => user_name } self.elements["atom:entry/apps:login"].add_attribute("password", passwd) if not passwd.nil? self.elements["atom:entry/apps:login"].add_attribute("hashFunctionName", hash_function_name) if not hash_function_name.nil? self.elements["atom:entry/apps:login"].add_attribute("admin", admin) if not admin.nil? self.elements["atom:entry/apps:login"].add_attribute("suspended", suspended) if not suspended.nil? self.elements["atom:entry/apps:login"].add_attribute("changePasswordAtNextLogin", change_passwd_at_next_login) if not change_passwd_at_next_login.nil? return self end |
#about_member(email_address) ⇒ Object
adds <apps:property> element in the message body for a member.
827 828 829 830 |
# File 'lib/provisioning-api.rb', line 827 def about_member(email_address) self.elements["atom:entry/atom:category"].add_attribute("term", "http://schemas.google.com/apps/2006#user") self.elements["atom:entry"].add_element "apps:property", {"name" => "memberId", "value" => email_address } end |
#about_name(family_name, given_name) ⇒ Object
adds <apps:name> in the message body.
862 863 864 865 |
# File 'lib/provisioning-api.rb', line 862 def about_name(family_name, given_name) self.elements["atom:entry"].add_element "apps:name", {"familyName" => family_name, "givenName" => given_name } return self end |
#about_nickname(name) ⇒ Object
adds <apps:nickname> in the message body.
868 869 870 871 872 |
# File 'lib/provisioning-api.rb', line 868 def about_nickname(name) self.elements["atom:entry/atom:category"].add_attribute("term", "http://schemas.google.com/apps/2006#nickname") self.elements["atom:entry"].add_element "apps:nickname", {"name" => name} return self end |
#about_owner(email_address) ⇒ Object
adds <apps:property> element in the message body for an owner.
833 834 835 836 |
# File 'lib/provisioning-api.rb', line 833 def about_owner(email_address) self.elements["atom:entry/atom:category"].add_attribute("term", "http://schemas.google.com/apps/2006#user") self.elements["atom:entry"].add_element "apps:property", {"name" => "email", "value" => email_address } end |
#about_quota(limit) ⇒ Object
adds <apps:quota> in the message body. limit in MB: integer
856 857 858 859 |
# File 'lib/provisioning-api.rb', line 856 def about_quota(limit) self.elements["atom:entry"].add_element "apps:quota", {"limit" => limit } return self end |
#about_who(email) ⇒ Object
adds <gd:who> in the message body.
875 876 877 878 |
# File 'lib/provisioning-api.rb', line 875 def about_who(email) self.elements["atom:entry"].add_element "gd:who", {"email" => email } return self end |
#add_path(url) ⇒ Object
adds <atom:id> element in the message body. Url is inserted as a text.
806 807 808 809 |
# File 'lib/provisioning-api.rb', line 806 def add_path(url) self.elements["atom:entry"].add_element "atom:id" self.elements["atom:entry/atom:id"].text = url end |