Class: Zm::Client::Account

Inherits:
Base::MailboxObject show all
Defined in:
lib/zm/client/account/account.rb

Overview

objectClass: zimbraAccount

Instance Attribute Summary

Attributes inherited from Base::MailboxObject

#carLicense, #domain_key, #home_url, #password, #public_url, #used

Attributes inherited from Base::Object

#id, #name, #parent, #token

Instance Method Summary collapse

Methods inherited from Base::MailboxObject

#account_content_by, #account_login, #account_login_password, #account_login_preauth, #aces, #admin_login, #appointments, #contacts, #data_sources, #dls_owner, #documents, #domain_name, #filter_rules, #folders, #identities, #infos, #is_external_transport?, #is_local_transport?, #last_logon, #local_transport, #local_transport!, #logged?, #login, #mailbox_infos, #mbxid, #mbxid!, #memberships, #messages, #mountpoints, #outgoing_filter_rules, #password!, #prefs, #rename!, #rest_account_connector, #search_folders, #shares, #signatures, #soap_account_connector, #tags, #tasks, #token_metadata, #update!, #uploader, #used!

Methods included from HasSoapAdminConnector

#soap_admin_connector

Methods inherited from Base::Object

#clone, #initialize, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute

Constructor Details

This class inherits a constructor from Zm::Client::Base::Object

Instance Method Details

#aliasesObject

################################################################# Associations #################################################################



13
14
15
# File 'lib/zm/client/account/account.rb', line 13

def aliases
  @aliases ||= AccountAliasesCollection.new(self)
end

#attrs_writeObject



54
55
56
# File 'lib/zm/client/account/account.rb', line 54

def attrs_write
  @parent.zimbra_attributes.
end

#cosObject



17
18
19
# File 'lib/zm/client/account/account.rb', line 17

def cos
  @cos ||= @parent.coses.find_by(id: zimbraCOSId)
end

#create!Object



35
36
37
38
# File 'lib/zm/client/account/account.rb', line 35

def create!
  resp = sac.invoke(jsns_builder.to_create)
  @id = resp[:CreateAccountResponse][:account].first[:id]
end

#created_atObject



40
41
42
# File 'lib/zm/client/account/account.rb', line 40

def created_at
  @created_at ||= Time.parse(zimbraCreateTimestamp) unless zimbraCreateTimestamp.nil?
end

#delete!Object

################################################################# SOAP Actions #################################################################



25
26
27
28
# File 'lib/zm/client/account/account.rb', line 25

def delete!
  sac.invoke(jsns_builder.to_delete)
  @id = nil
end

#flush_cache!Object



44
45
46
47
48
49
50
51
52
# File 'lib/zm/client/account/account.rb', line 44

def flush_cache!
  soap_request = SoapElement.admin(SoapAdminConstants::FLUSH_CACHE_REQUEST)
  node_cache = SoapElement.create('cache').add_attributes({ type: SoapConstants::ACCOUNT, allServers: 1 })
  soap_request.add_node(node_cache)
  node_entry = SoapElement.create('entry').add_attribute(SoapConstants::BY, SoapConstants::ID).add_content(@id)
  node_cache.add_node(node_entry)
  sac.invoke(soap_request)
  true
end

#modify!Object



30
31
32
33
# File 'lib/zm/client/account/account.rb', line 30

def modify!
  sac.invoke(jsns_builder.to_update)
  true
end