google_apps 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/google_apps/atom/user.rb +11 -0
- data/lib/google_apps/transport.rb +10 -2
- metadata +1 -1
@@ -52,6 +52,17 @@ module GoogleApps
|
|
52
52
|
end
|
53
53
|
|
54
54
|
|
55
|
+
def update_node(user_name = nil, password = nil, suspended = nil)
|
56
|
+
login = Atom::XML::Node.new('apps:login')
|
57
|
+
login['userName'] = user_name unless user_name.nil?
|
58
|
+
login['password'] = password unless password.nil?
|
59
|
+
login['suspended'] = suspended unless suspended.nil?
|
60
|
+
|
61
|
+
@document.root << login
|
62
|
+
login
|
63
|
+
end
|
64
|
+
|
65
|
+
|
55
66
|
# quota_node adds an apps:quota attribute to @document.
|
56
67
|
# quota_node takes an integer value as an argument. This
|
57
68
|
# argument translates to the number of megabytes available
|
@@ -118,6 +118,7 @@ module GoogleApps
|
|
118
118
|
#
|
119
119
|
# get returns the HTTP response received from Google.
|
120
120
|
def get(endpoint, id = nil)
|
121
|
+
# TODO: Need to handle <link rel='next' for pagination if wanting all users
|
121
122
|
id ? uri = URI(instance_variable_get("@#{endpoint.to_s}") + "/#{id}") : uri = URI(instance_variable_get("@#{endpoint.to_s}"))
|
122
123
|
#uri = URI(instance_variable_get("@#{endpoint.to_s}") + "/#{id}")
|
123
124
|
@request = Net::HTTP::Get.new(uri.path)
|
@@ -152,9 +153,14 @@ module GoogleApps
|
|
152
153
|
# update 'endpoint', document
|
153
154
|
#
|
154
155
|
# update returns the HTTP response received from Google
|
155
|
-
def update(endpoint, document)
|
156
|
+
def update(endpoint, target, document)
|
156
157
|
# TODO: Username needs to come from somewhere for uri
|
157
|
-
uri = URI(instance_variable_get("@#{endpoint.to_s}") + "
|
158
|
+
uri = URI(instance_variable_get("@#{endpoint.to_s}") + "/#{target}")
|
159
|
+
@request = Net::HTTP::Put.new(uri.path)
|
160
|
+
@request.body = document.to_s
|
161
|
+
set_headers :user
|
162
|
+
|
163
|
+
@response = request(uri)
|
158
164
|
end
|
159
165
|
|
160
166
|
# delete is a generic target for method_missing. It is
|
@@ -198,6 +204,8 @@ module GoogleApps
|
|
198
204
|
self.send(:add, $2, *args)
|
199
205
|
when "delete"
|
200
206
|
self.send(:delete, $2, *args)
|
207
|
+
when "update"
|
208
|
+
self.send(:update, $2, *args)
|
201
209
|
when "get"
|
202
210
|
self.send(:get, $2, *args)
|
203
211
|
else
|