zimbra_wsdl 0.0.2

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/examples/savon.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'savon'
2
+ require 'zimbra_wsdl'
3
+
4
+ require File.expand_path('../zimbra_authentication.rb', __FILE__)
5
+
6
+ Savon.configure do |config|
7
+ config.log = false
8
+ config.log_level = :info
9
+ # config.logger = Logger.new('/tmp/zimbra_wsdl_savon_example.log')
10
+ end
11
+
12
+ client = Savon::Client.new do
13
+ wsdl.document = ZimbraWsdl.admin_wsdl
14
+ wsdl.endpoint = "https://#{ZIMBRA_SERVER}:7071/service/admin/soap"
15
+ http.auth.ssl.verify_mode = :none
16
+ end
17
+
18
+ # Authenticate your client (NOTICE: ruby 1.9 hash syntax)
19
+ client.request :auth_request, body: { name: ZIMBRA_ADMIN_USERNAME, password: ZIMBRA_ADMIN_PASSWORD }
20
+
21
+ # Once authenticated you can call any api method
22
+ accounts_response = client.request :get_all_accounts_request
23
+ accounts = accounts_response.to_array(:get_all_accounts_response, :account)
24
+
25
+ accounts.each do |account|
26
+ puts account[:@name]
27
+ end
@@ -0,0 +1,3 @@
1
+ ZIMBRA_SERVER = "zimbra.example.com"
2
+ ZIMBRA_ADMIN_USERNAME = "admin@zimbra.example.com"
3
+ ZIMBRA_ADMIN_PASSWORD = "YOUR_SECRET_PASSWORD"