postini 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/postini/automated_batch_service.rb +86 -0
- data/lib/postini.rb +1 -1
- metadata +2 -2
@@ -202,6 +202,59 @@ module Postini
|
|
202
202
|
end
|
203
203
|
requires_configured :display_user
|
204
204
|
|
205
|
+
# Return a list of users, possibly filtered and sorted. Refer to
|
206
|
+
# the Postini Automated Batch Service Manual for an explanation of
|
207
|
+
# each field.
|
208
|
+
#
|
209
|
+
# Possible options are:
|
210
|
+
#
|
211
|
+
# :aliases => boolean
|
212
|
+
# :childorgs => boolean
|
213
|
+
# :start => integer
|
214
|
+
# :end => integer
|
215
|
+
# :fields => array (strings)
|
216
|
+
# :orgtagqs => string
|
217
|
+
# :primaryqs => string
|
218
|
+
# :targetOrg => string
|
219
|
+
# :type_of_user => string
|
220
|
+
#
|
221
|
+
# The call returns a giant hash, keys are the addresses returned
|
222
|
+
# by the operation, and the values are hashes of key-value pairs
|
223
|
+
# are returned by the remote service.
|
224
|
+
def list_users( query_string = 'ALL', options = {} )
|
225
|
+
|
226
|
+
valid_options = {}
|
227
|
+
|
228
|
+
# vanilla copies
|
229
|
+
[ :start, :end, :orgtagqs, :primaryqs, :targetOrg, :type_of_user ].each do |k|
|
230
|
+
|
231
|
+
valid_options[k] = options[k] if options.has_key?(k)
|
232
|
+
end
|
233
|
+
|
234
|
+
# boolean copies
|
235
|
+
[ :aliases, :childorgs ].each do |k|
|
236
|
+
|
237
|
+
if options.has_key?(k)
|
238
|
+
valid_options[k] = ( options[k] == true ? '1' : '0' )
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
valid_options[:fields] = options[:fields].join('|') if options.has_key?(:fields)
|
243
|
+
|
244
|
+
response = invoke("aut:listusers") do |message|
|
245
|
+
build_auth!( message )
|
246
|
+
message.add('queryString', query_string)
|
247
|
+
message.add('queryParams') do |q|
|
248
|
+
valid_options.each do |k,v|
|
249
|
+
q.add( k.to_s, v )
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
parse_list_users_results( response.document.xpath('//tns:listusersResponse', tns).first )
|
255
|
+
end
|
256
|
+
requires_configured :list_users
|
257
|
+
|
205
258
|
# Modify a domain by moving it to a new organization, setting or
|
206
259
|
# removing aliases, or enabling/disabling subdomain
|
207
260
|
# stripping. Changes are passed as a hash with the following keys:
|
@@ -460,5 +513,38 @@ module Postini
|
|
460
513
|
|
461
514
|
data
|
462
515
|
end
|
516
|
+
|
517
|
+
def parse_list_users_results( node )
|
518
|
+
# <tns:listusersResponse>
|
519
|
+
# <user>
|
520
|
+
# <active>0</active>
|
521
|
+
# <address>sales@jumboinc.com</address>
|
522
|
+
# <create_method>3</create_method>
|
523
|
+
# <orgtag>Sales</orgtag>
|
524
|
+
# <timezone>Europe/Lisbon</timezone>
|
525
|
+
# </user>
|
526
|
+
# <user>
|
527
|
+
# ...
|
528
|
+
# </user
|
529
|
+
# </tns:listusersResponse>
|
530
|
+
|
531
|
+
data = {}
|
532
|
+
|
533
|
+
node.xpath('./user').each do |user|
|
534
|
+
|
535
|
+
address = user.xpath('./address/text()').to_s
|
536
|
+
fields = {}
|
537
|
+
|
538
|
+
user.children.each do |field|
|
539
|
+
next if field.name == 'address'
|
540
|
+
|
541
|
+
fields[ field.name.to_sym ] = field.content
|
542
|
+
end
|
543
|
+
|
544
|
+
data[ address ] = fields
|
545
|
+
end
|
546
|
+
|
547
|
+
data
|
548
|
+
end
|
463
549
|
end
|
464
550
|
end
|
data/lib/postini.rb
CHANGED
@@ -76,7 +76,7 @@ require 'postini/exceptions'
|
|
76
76
|
# degrees, and allow you to access some soap4r internals as well.
|
77
77
|
#
|
78
78
|
module Postini
|
79
|
-
VERSION = "0.1.
|
79
|
+
VERSION = "0.1.1"
|
80
80
|
|
81
81
|
autoload :ConfigurationCheck, "postini/configuration_check"
|
82
82
|
autoload :Endpoints, "postini/endpoints"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postini
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Kalmer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-16 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|