Class: Zm::Client::MailboxInfosCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/base/mailbox_infos_collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ MailboxInfosCollection

Returns a new instance of MailboxInfosCollection.



6
7
8
9
10
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 6

def initialize(parent)
  @parent = parent
  @sections = []
  @rights = []
end

Instance Method Details

#allObject



12
13
14
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 12

def all
  @all || all!
end

#all!Object



16
17
18
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 16

def all!
  build_response
end

#clearObject



20
21
22
23
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 20

def clear
  reset_query_params
  @all.clear
end

#readObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 35

def read
  reset_query_params
  @sections = ['mbox']
  rep = build_response
  @parent.id = rep[:id]
  @parent.used = rep[:used]
  @parent.public_url = rep[:publicURL]
  @parent.zimbraCOSId = rep[:cos][:id]
  @parent.home_url = rep[:rest]
  rep
end

#rights(*entries) ⇒ Object



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

def rights(*entries)
  @rights += entries
  self
end

#sections(*entries) ⇒ Object



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

def sections(*entries)
  @sections += entries
  self
end

#zimbraMailHostObject



47
48
49
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 47

def zimbraMailHost
  @zimbraMailHost || zimbraMailHost!
end

#zimbraMailHost!Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 51

def zimbraMailHost!
  return if @parent.name.nil? && @parent.id.nil?

  soap_request = SoapElement.(SoapAccountConstants::GET_ACCOUNT_INFO_REQUEST)

  if @parent.id
    node_entry = SoapElement.create(SoapConstants::ACCOUNT).add_attribute(SoapConstants::BY, SoapConstants::ID).add_content(@parent.id)
  else
    node_entry = SoapElement.create(SoapConstants::ACCOUNT).add_attribute(SoapConstants::BY, SoapConstants::NAME).add_content(@parent.name)
  end

  soap_request.add_node(node_entry)

  @zimbraMailHost = @parent.sacc.invoke(soap_request).dig(:GetAccountInfoResponse, :_attrs, :zimbraMailHost)
end