zm-ruby-client
Library to interface with Zimbra simply.
Author: Maxime Désécot maxime.desecot@gmail.com
Installation
OS: Linux distribution LTS
Language: Ruby2.7+
gem install zm-ruby-client
Examples of uses:
Connection:
admin = Zm::Client::Cluster.new(Zm::Client::ClusterConfig.new('config.json'))
admin.login
or
config = Zm::Client::ClusterConfig.new do |cc|
cc.zimbra_admin_host = 'mail.domain.tld'
cc.zimbra_admin_scheme = 'https'
cc.zimbra_admin_port = 443
cc.zimbra_admin_login = 'admin@domain.tld'
cc.zimbra_admin_password = 'secret'
end
admin = Zm::Client::Cluster.new(config)
admin.login
List all accounts
filter = '(&(mail=*@domain.tld)(zimbraLastLogonTimestamp<=20190225000000Z))'
accounts = admin.accounts.where(filter).all
Find an account
account = admin.accounts.find_by name: 'maxime@domain.tld'
Create an account
account = Zm::Client::Account.new(admin) do |acc|
acc.name = 'maxime@domain.tld'
end
account.zimbraMailQuota = 0
account.save