google_apps 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,15 @@ module GoogleApps
|
|
6
6
|
add_header
|
7
7
|
end
|
8
8
|
|
9
|
+
# new_group populates the Group XML document with
|
10
|
+
# the provided values. new_group accepts a hash
|
11
|
+
# with the following keys: id, name, description
|
12
|
+
# and perms.
|
13
|
+
#
|
14
|
+
# new_group id: 'ID', name: 'Name', description: 'Group Description',
|
15
|
+
# perms: 'emailPermissions'
|
16
|
+
#
|
17
|
+
# new_group returns @document.root
|
9
18
|
def new_group(group_data)
|
10
19
|
group_data.keys.each do |key|
|
11
20
|
prop = Atom::XML::Node.new('apps:property')
|
@@ -13,14 +22,19 @@ module GoogleApps
|
|
13
22
|
prop.attributes['value'] = group_data[key]
|
14
23
|
@document.root << prop
|
15
24
|
end
|
25
|
+
|
26
|
+
@document.root
|
16
27
|
end
|
17
28
|
|
29
|
+
# to_s returns @document as a String.
|
18
30
|
def to_s
|
19
31
|
@document.to_s
|
20
32
|
end
|
21
33
|
|
22
34
|
private
|
23
35
|
|
36
|
+
# add_header sets the required boilerplate for a
|
37
|
+
# Google Apps group.
|
24
38
|
def add_header
|
25
39
|
@document.root = Atom::XML::Node.new('atom:entry')
|
26
40
|
|
@@ -29,6 +43,11 @@ module GoogleApps
|
|
29
43
|
Atom::XML::Namespace.new(@document.root, 'gd', 'http://schemas.google.com/g/2005')
|
30
44
|
end
|
31
45
|
|
46
|
+
# prop_name takes a LibXML::XML::Node object and
|
47
|
+
# sets the name attribute based on the provided
|
48
|
+
# key.
|
49
|
+
#
|
50
|
+
# prop_name returns the modified LibXML::XML::Node
|
32
51
|
def prop_name(property, key)
|
33
52
|
case key
|
34
53
|
when :id
|
@@ -6,6 +6,12 @@ module GoogleApps
|
|
6
6
|
add_header
|
7
7
|
end
|
8
8
|
|
9
|
+
# new_key adds the actual key to the PublicKey
|
10
|
+
# XML document.
|
11
|
+
#
|
12
|
+
# new_key 'key'
|
13
|
+
#
|
14
|
+
# new_key returns @document.root
|
9
15
|
def new_key(key)
|
10
16
|
property = Atom::XML::Node.new('apps:property')
|
11
17
|
property['name'] = 'publicKey'
|
@@ -14,6 +20,7 @@ module GoogleApps
|
|
14
20
|
@document.root << property
|
15
21
|
end
|
16
22
|
|
23
|
+
# to_s returns @document as a String
|
17
24
|
def to_s
|
18
25
|
@document.to_s
|
19
26
|
end
|
@@ -25,7 +25,7 @@ module GoogleApps
|
|
25
25
|
def login_node(user_name, password)
|
26
26
|
login = Atom::XML::Node.new('apps:login')
|
27
27
|
login['userName'] = user_name
|
28
|
-
login['password'] = Digest::SHA1.hexdigest password
|
28
|
+
login['password'] = OpenSSL::Digest::SHA1.hexdigest password
|
29
29
|
login['hashFunctionName'] = Atom::HASH_FUNCTION
|
30
30
|
login['suspended'] = "false"
|
31
31
|
|