Class: Zm::Client::MailboxPrefsCollection

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

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ MailboxPrefsCollection

Returns a new instance of MailboxPrefsCollection.



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

def initialize(parent)
  @parent = parent
  @preferences = []
end

Instance Method Details

#allObject Also known as: all!



11
12
13
# File 'lib/zm/client/base/mailbox_prefs_collection.rb', line 11

def all
  build_response
end

#clearObject



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

def clear
  reset_query_params
end

#preferences(*entries) ⇒ Object



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

def preferences(*entries)
  entries.flatten!
  @preferences += entries
  self
end

#update!(hash) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/zm/client/base/mailbox_prefs_collection.rb', line 26

def update!(hash)
  # The JSON version is different:
  # {
  #   ModifyPrefsRequest: {
  #     "_attrs": {
  #       "prefName1": "prefValue1",
  #       "prefName2": "prefValue2"
  #       "+nameOfMulitValuedPref3": "addedPrefValue3",
  #       "-nameOfMulitValuedPref4": "removedPrefValue4",
  #       "nameOfMulitValuedPref5": ["prefValue5one","prefValue5two"],
  #       ...
  #     },
  #     _jsns: "urn:zimbraAccount"
  #   }
  # }

  req = {
    _attrs: hash
  }

  soap_request = SoapElement.(SoapAccountConstants::MODIFY_PREFS_REQUEST).add_attributes(req)
  @parent.soap_connector.invoke(soap_request)
end