Class: Zm::Client::Account

Inherits:
Base::MailboxObject show all
Includes:
RequestMethodsAdmin
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 included from RequestMethodsAdmin

#build_create, #build_delete, #build_modify, #build_rename, #delete!, #modify!, #rename!, #update!

Methods inherited from Base::MailboxObject

#account_content_by, #account_login, #account_login_password, #account_login_preauth, #aces, #admin_login, #alive?, #appointments, #build_uploader, #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?, #logged_and_alive?, #login, #mailbox_infos, #mbxid, #mbxid!, #memberships, #messages, #mountpoints, #outgoing_filter_rules, #password!, #prefs, #rest_account_url, #rest_admin_url, #rest_options, #rest_url, #search_folders, #shares, #signatures, #soap_account_connector, #soap_connector, #tags, #tasks, #token, #token=, #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 #################################################################



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

def aliases
  return @aliases if defined? @aliases

  @aliases = AccountAliasesCollection.new(self)
end

#attrs_writeObject



59
60
61
# File 'lib/zm/client/account/account.rb', line 59

def attrs_write
  @parent.zimbra_attributes.
end

#batchObject



69
70
71
72
73
# File 'lib/zm/client/account/account.rb', line 69

def batch
  return @batch if defined? @batch

  @batch = BatchRequest.new()
end

#build_flush_cacheObject



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/zm/client/account/account.rb', line 47

def build_flush_cache
  soap_request = SoapElement.admin(SoapAdminConstants::FLUSH_CACHE_REQUEST)
  node_cache = SoapElement.create('cache')
                          .add_attributes({ type: SoapConstants::ACCOUNT, allServers: SoapUtils::ON })
  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)
  soap_request
end

#cosObject



21
22
23
24
25
# File 'lib/zm/client/account/account.rb', line 21

def cos
  return @cos if defined? @cos

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

#create!Object

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



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

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

#created_atObject



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

def created_at
  return @created_at if defined? @created_at

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

#flush_cache!Object



42
43
44
45
# File 'lib/zm/client/account/account.rb', line 42

def flush_cache!
  sac.invoke(build_flush_cache)
  true
end

#jsns_builderObject



63
64
65
66
67
# File 'lib/zm/client/account/account.rb', line 63

def jsns_builder
  return @jsns_builder if defined? @jsns_builder

  @jsns_builder = AccountJsnsBuilder.new(self)
end