zm-ruby-client
Library to interface with Zimbra simply.
Author: Maxime Désécot [email protected]
Installation
OS: Linux distribution LTS
Language: Ruby3.2+
gem install zm-ruby-client
Examples of uses:
Connection:
cluster = Zm::Client::Cluster.new(Zm::Client::ClusterConfig.new('config.json'))
cluster.login
or
config = Zm::Client::ClusterConfig.new do |cc|
cc.zimbra_admin_url = 'https://mail.domain.tld:7071'
cc.zimbra_admin_login = '[email protected]'
cc.zimbra_admin_password = 'secret'
end
cluster = Zm::Client::Cluster.new(config)
cluster.login
List all accounts
filter = '(&(mail=*@domain.tld)(zimbraLastLogonTimestamp<=20190225000000Z))'
accounts = cluster.accounts.where(filter).all
Find an account
account = cluster.accounts.find_by name: '[email protected]'
Create an account
account = Zm::Client::Account.new(cluster) do |acc|
acc.name = '[email protected]'
end
account.zimbraMailQuota = 0
account.save