Class: Zm::Client::MailboxInfosCollection
- Inherits:
-
Object
- Object
- Zm::Client::MailboxInfosCollection
- Defined in:
- lib/zm/client/base/mailbox_infos_collection.rb
Instance Method Summary collapse
- #all ⇒ Object (also: #all!)
- #clear ⇒ Object
-
#initialize(parent) ⇒ MailboxInfosCollection
constructor
A new instance of MailboxInfosCollection.
- #read ⇒ Object
- #rights(*entries) ⇒ Object
- #sections(*entries) ⇒ Object
- #zimbraMailHost ⇒ Object
- #zimbraMailHost! ⇒ Object
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
#all ⇒ Object Also known as: all!
12 13 14 |
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 12 def all build_response end |
#clear ⇒ Object
17 18 19 |
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 17 def clear reset_query_params end |
#read ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 33 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
27 28 29 30 31 |
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 27 def rights(*entries) entries.flatten! @rights += entries self end |
#sections(*entries) ⇒ Object
21 22 23 24 25 |
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 21 def sections(*entries) entries.flatten! @sections += entries self end |
#zimbraMailHost ⇒ Object
45 46 47 |
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 45 def zimbraMailHost @zimbraMailHost || zimbraMailHost! end |
#zimbraMailHost! ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/zm/client/base/mailbox_infos_collection.rb', line 49 def zimbraMailHost! return if @parent.name.nil? && @parent.id.nil? soap_request = SoapElement.account(SoapAccountConstants::GET_ACCOUNT_INFO_REQUEST) node_entry = if @parent.id SoapElement.create(SoapConstants::ACCOUNT) .add_attribute(SoapConstants::BY, SoapConstants::ID) .add_content(@parent.id) else SoapElement.create(SoapConstants::ACCOUNT) .add_attribute(SoapConstants::BY, SoapConstants::NAME) .add_content(@parent.name) end soap_request.add_node(node_entry) @zimbraMailHost = @parent.soap_connector .invoke(soap_request) .dig(:GetAccountInfoResponse, :_attrs, :zimbraMailHost) end |