Class: Zm::Client::Cos

Inherits:
Base::Object show all
Includes:
HasSoapAdminConnector
Defined in:
lib/zm/client/cos/cos.rb

Overview

objectClass: zimbraCos

Instance Attribute Summary

Attributes inherited from Base::Object

#id, #name, #parent, #token

Instance Method Summary collapse

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

#accountsObject



51
52
53
54
55
# File 'lib/zm/client/cos/cos.rb', line 51

def accounts
  return if @id.nil?

  @accounts ||= CosAccountsCollection.new(self)
end

#attrs_writeObject



57
58
59
# File 'lib/zm/client/cos/cos.rb', line 57

def attrs_write
  @parent.zimbra_attributes.all_cos_attrs_writable_names
end

#clone!(new_name) ⇒ Object



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

def clone!(new_name)
  resp = sac.invoke(jsns_builder.to_copy(new_name))
  resp[:CopyCosResponse][:cos].first[:id]
end

#create!Object



26
27
28
29
30
# File 'lib/zm/client/cos/cos.rb', line 26

def create!
  resp = sac.invoke(jsns_builder.to_create)

  @id = resp[:CreateCosResponse][:cos].first[:id]
end

#delete!Object



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

def delete!
  sac.invoke(jsns_builder.to_delete)
end

#domainsObject



45
46
47
48
49
# File 'lib/zm/client/cos/cos.rb', line 45

def domains
  return if @id.nil?

  @domains ||= CosDomainsCollection.new(self)
end

#modify!Object



9
10
11
12
# File 'lib/zm/client/cos/cos.rb', line 9

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

#serversObject



41
42
43
# File 'lib/zm/client/cos/cos.rb', line 41

def servers
  @servers ||= CosServersCollection.new(self)
end

#update!(hash) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/zm/client/cos/cos.rb', line 14

def update!(hash)
  return false if hash.delete_if { |k, v| v.nil? || !respond_to?(k) }.empty?

  do_update!(hash)

  hash.each do |key, value|
    update_attribute(key, value)
  end

  true
end