Class: GAppsProvisioning::RequestMessage

Inherits:
Document
  • Object
show all
Defined in:
lib/gappsprovisioning/provisioningapi.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeRequestMessage

creates the object and initiates the construction


789
790
791
792
793
794
795
# File 'lib/gappsprovisioning/provisioningapi.rb', line 789

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.


804
805
806
807
# File 'lib/gappsprovisioning/provisioningapi.rb', line 804

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.


810
811
812
813
814
815
816
# File 'lib/gappsprovisioning/provisioningapi.rb', line 810

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


835
836
837
838
839
840
841
842
843
844
# File 'lib/gappsprovisioning/provisioningapi.rb', line 835

def (user_name, passwd=nil, hash_function_name=nil, admin=nil, suspended=nil, =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", ) if not .nil?
	return self
end

#about_member(email_address) ⇒ Object

adds <apps:property> element in the message body for a member.


819
820
821
822
# File 'lib/gappsprovisioning/provisioningapi.rb', line 819

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.


854
855
856
857
# File 'lib/gappsprovisioning/provisioningapi.rb', line 854

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.


860
861
862
863
864
# File 'lib/gappsprovisioning/provisioningapi.rb', line 860

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.


825
826
827
828
# File 'lib/gappsprovisioning/provisioningapi.rb', line 825

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


848
849
850
851
# File 'lib/gappsprovisioning/provisioningapi.rb', line 848

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.


867
868
869
870
# File 'lib/gappsprovisioning/provisioningapi.rb', line 867

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.


798
799
800
801
# File 'lib/gappsprovisioning/provisioningapi.rb', line 798

def add_path(url)
	self.elements["atom:entry"].add_element "atom:id"
	self.elements["atom:entry/atom:id"].text = url
end