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



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

def all
  @all || all!
end

#all!Object



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

def all!
  build_response
end

#clearObject



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

def clear
  reset_query_params
  @all.clear
end

#preferences(*entries) ⇒ Object



24
25
26
27
# File 'lib/zm/client/base/mailbox_prefs_collection.rb', line 24

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

#update!(hash) ⇒ Object



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

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.sacc.invoke(soap_request)
end