Class: GAppsProvisioning::RequestMessage

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(with_category = true) ⇒ RequestMessage

creates the object and initiates the construction



855
856
857
858
859
860
861
# File 'lib/gappsprovisioning/provisioningapi.rb', line 855

def initialize(with_category=true)
  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"} if with_category
end

Instance Method Details

#about_email_list(email_list) ⇒ Object

deprecated adds <apps:emailList> element in the message body.



887
888
889
890
# File 'lib/gappsprovisioning/provisioningapi.rb', line 887

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, group_name, description = nil, email_permission = 'Member') ⇒ Object

The XML uses the “groupName” to specify the name of the group.



870
871
872
873
874
875
# File 'lib/gappsprovisioning/provisioningapi.rb', line 870

def about_group(group_id, group_name, description=nil, email_permission='Member')
  self.elements["atom:entry"].add_element "apps:property", {"name" => "groupId", "value" => group_id } 
  self.elements["atom:entry"].add_element "apps:property", {"name" => "groupName", "value" => group_name } 
  self.elements["atom:entry"].add_element "apps:property", {"name" => "description", "value" => description } if not description.nil? 
  self.elements["atom:entry"].add_element "apps:property", {"name" => "emailPermission", "value" => email_permission } 
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” or nil



897
898
899
900
901
902
903
904
905
906
# File 'lib/gappsprovisioning/provisioningapi.rb', line 897

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(member_id) ⇒ Object



877
878
879
# File 'lib/gappsprovisioning/provisioningapi.rb', line 877

def about_member(member_id)
  self.elements["atom:entry"].add_element "apps:property", {"name" => "memberId", "value"=> member_id } 
end

#about_name(family_name, given_name) ⇒ Object

adds <apps:name> in the message body.



916
917
918
919
# File 'lib/gappsprovisioning/provisioningapi.rb', line 916

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.



922
923
924
925
926
# File 'lib/gappsprovisioning/provisioningapi.rb', line 922

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(owner_email) ⇒ Object



881
882
883
# File 'lib/gappsprovisioning/provisioningapi.rb', line 881

def about_owner(owner_email)
  self.elements["atom:entry"].add_element "apps:property", {"name" => "email", "value" => owner_email } 
end

#about_quota(limit) ⇒ Object

adds <apps:quota> in the message body. limit in MB: integer



910
911
912
913
# File 'lib/gappsprovisioning/provisioningapi.rb', line 910

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.



929
930
931
932
# File 'lib/gappsprovisioning/provisioningapi.rb', line 929

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.



864
865
866
867
# File 'lib/gappsprovisioning/provisioningapi.rb', line 864

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