Class: Zm::Client::Base::MailboxObject
Overview
Abstract Class for Account and Resource
Instance Attribute Summary collapse
Attributes inherited from Object
#id, #name, #parent, #token
Instance Method Summary
collapse
#soap_admin_connector
Methods inherited from Object
#clone, #initialize, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute
Instance Attribute Details
#carLicense ⇒ Object
Returns the value of attribute carLicense.
28
29
30
|
# File 'lib/zm/client/base/mailbox_object.rb', line 28
def carLicense
@carLicense
end
|
#domain_key ⇒ Object
85
86
87
88
89
90
|
# File 'lib/zm/client/base/mailbox_object.rb', line 85
def domain_key
return @domain_key if @domain_key
return @parent.domain_key(domain_name) if @parent.logged?
nil
end
|
Returns the value of attribute home_url.
28
29
30
|
# File 'lib/zm/client/base/mailbox_object.rb', line 28
def home_url
@home_url
end
|
Returns the value of attribute password.
28
29
30
|
# File 'lib/zm/client/base/mailbox_object.rb', line 28
def password
@password
end
|
#public_url ⇒ Object
Returns the value of attribute public_url.
28
29
30
|
# File 'lib/zm/client/base/mailbox_object.rb', line 28
def public_url
@public_url
end
|
54
55
56
|
# File 'lib/zm/client/base/mailbox_object.rb', line 54
def used
@used || used!
end
|
Instance Method Details
#account_content_by ⇒ Object
128
129
130
|
# File 'lib/zm/client/base/mailbox_object.rb', line 128
def account_content_by
@id ? [@id, :id] : [@name, :name]
end
|
#account_login ⇒ Object
100
101
102
103
104
105
106
107
108
|
# File 'lib/zm/client/base/mailbox_object.rb', line 100
def account_login
sacc.token = nil
if password
account_login_password
else
account_login_preauth
end
end
|
#account_login_password ⇒ Object
119
120
121
122
123
124
125
126
|
# File 'lib/zm/client/base/mailbox_object.rb', line 119
def account_login_password
raise ZmError, 'password is required to login !' if password.nil?
content, by = account_content_by
@token = sacc.auth_password(content, by, @password)
sacc.context.token(@token)
end
|
#account_login_preauth(expires = 0) ⇒ Object
110
111
112
113
114
115
116
117
|
# File 'lib/zm/client/base/mailbox_object.rb', line 110
def account_login_preauth(expires = 0)
raise ZmError, 'domain key is required to login !' if domain_key.nil?
content, by = account_content_by
@token = sacc.auth_preauth(content, by, expires, domain_key)
sacc.context.token(@token)
end
|
#aces ⇒ Object
Also known as:
rights
197
198
199
|
# File 'lib/zm/client/base/mailbox_object.rb', line 197
def aces
@aces ||= AcesCollection.new(self)
end
|
#appointments ⇒ Object
185
186
187
|
# File 'lib/zm/client/base/mailbox_object.rb', line 185
def appointments
@appointments ||= AppointmentsCollection.new(self)
end
|
181
182
183
|
# File 'lib/zm/client/base/mailbox_object.rb', line 181
def contacts
@contacts ||= ContactsCollection.new(self)
end
|
#data_sources ⇒ Object
226
227
228
|
# File 'lib/zm/client/base/mailbox_object.rb', line 226
def data_sources
@data_sources ||= DataSourcesCollection.new(self)
end
|
#documents ⇒ Object
206
207
208
|
# File 'lib/zm/client/base/mailbox_object.rb', line 206
def documents
@documents ||= DocumentsCollection.new(self)
end
|
#domain_name ⇒ Object
42
43
44
|
# File 'lib/zm/client/base/mailbox_object.rb', line 42
def domain_name
@domain_name ||= @name.split('@').last
end
|
#filter_rules ⇒ Object
218
219
220
|
# File 'lib/zm/client/base/mailbox_object.rb', line 218
def filter_rules
@filter_rules ||= FilterRulesCollection.new(self)
end
|
161
162
163
|
# File 'lib/zm/client/base/mailbox_object.rb', line 161
def folders
@folders ||= FoldersCollection.new(self)
end
|
#identities ⇒ Object
173
174
175
|
# File 'lib/zm/client/base/mailbox_object.rb', line 173
def identities
@identities ||= IdentitiesCollection.new(self)
end
|
#is_external_transport? ⇒ Boolean
281
282
283
284
285
|
# File 'lib/zm/client/base/mailbox_object.rb', line 281
def is_external_transport?
return nil unless zimbraMailTransport
zimbraMailTransport.start_with?(SoapConstants::SMTP)
end
|
#is_local_transport? ⇒ Boolean
275
276
277
278
279
|
# File 'lib/zm/client/base/mailbox_object.rb', line 275
def is_local_transport?
return nil unless zimbraMailTransport
zimbraMailTransport.start_with?(SoapConstants::LMTP)
end
|
#last_logon ⇒ Object
287
288
289
|
# File 'lib/zm/client/base/mailbox_object.rb', line 287
def last_logon
@last_logon ||= Time.parse(zimbraLastLogonTimestamp) unless zimbraLastLogonTimestamp.nil?
end
|
#local_transport ⇒ Object
265
266
267
268
269
|
# File 'lib/zm/client/base/mailbox_object.rb', line 265
def local_transport
raise Zm::Client::ZmError, 'zimbraMailHost is null' if zimbraMailHost.nil?
"lmtp:#{zimbraMailHost}:7025"
end
|
#local_transport! ⇒ Object
271
272
273
|
# File 'lib/zm/client/base/mailbox_object.rb', line 271
def local_transport!
update!(zimbraMailTransport: local_transport)
end
|
#logged? ⇒ Boolean
################################################################# Authentication #################################################################
81
82
83
|
# File 'lib/zm/client/base/mailbox_object.rb', line 81
def logged?
!@token.nil?
end
|
92
93
94
95
96
97
98
|
# File 'lib/zm/client/base/mailbox_object.rb', line 92
def login
if parent_logged?
admin_login
else
account_login
end
end
|
62
63
64
|
# File 'lib/zm/client/base/mailbox_object.rb', line 62
def mbxid
@mbxid || mbxid!
end
|
66
67
68
|
# File 'lib/zm/client/base/mailbox_object.rb', line 66
def mbxid!
@mbxid = mailbox_infos[:mbxid]
end
|
157
158
159
|
# File 'lib/zm/client/base/mailbox_object.rb', line 157
def messages
@messages ||= MessagesCollection.new(self)
end
|
#mountpoints ⇒ Object
165
166
167
|
# File 'lib/zm/client/base/mailbox_object.rb', line 165
def mountpoints
@mountpoints ||= MountPointsCollection.new(self)
end
|
#outgoing_filter_rules ⇒ Object
222
223
224
|
# File 'lib/zm/client/base/mailbox_object.rb', line 222
def outgoing_filter_rules
@outgoing_filter_rules ||= OutgoingFilterRulesCollection.new(self)
end
|
#password!(new_password = nil) ⇒ Object
################################################################# SOAP Actions #################################################################
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/zm/client/base/mailbox_object.rb', line 234
def password!(new_password = nil)
new_password ||= @password
return false if new_password.nil?
soap_request = SoapElement.admin(SoapAdminConstants::SET_PASSWORD_REQUEST)
soap_request.add_attributes({ id: @id, newPassword: new_password })
sac.invoke(soap_request)
@password = new_password
end
|
#rest_account_connector ⇒ Object
Also known as:
rac
36
37
38
|
# File 'lib/zm/client/base/mailbox_object.rb', line 36
def rest_account_connector
@rest_account_connector ||= RestAccountConnector.new
end
|
#search_folders ⇒ Object
169
170
171
|
# File 'lib/zm/client/base/mailbox_object.rb', line 169
def search_folders
@search_folders ||= SearchFoldersCollection.new(self)
end
|
177
178
179
|
# File 'lib/zm/client/base/mailbox_object.rb', line 177
def shares
@shares ||= SharesCollection.new(self)
end
|
#signatures ⇒ Object
202
203
204
|
# File 'lib/zm/client/base/mailbox_object.rb', line 202
def signatures
@signatures ||= SignaturesCollection.new(self)
end
|
#soap_account_connector ⇒ Object
Also known as:
sacc
31
32
33
|
# File 'lib/zm/client/base/mailbox_object.rb', line 31
def soap_account_connector
@soap_account_connector ||= SoapAccountConnector.create(soap_config)
end
|
189
190
191
|
# File 'lib/zm/client/base/mailbox_object.rb', line 189
def tags
@tags ||= TagsCollection.new(self)
end
|
193
194
195
|
# File 'lib/zm/client/base/mailbox_object.rb', line 193
def tasks
@tasks ||= TasksCollection.new(self)
end
|
################################################################# Associations #################################################################
153
154
155
|
# File 'lib/zm/client/base/mailbox_object.rb', line 153
def token_metadata
@token_metadata ||= TokenMetaData.new(@token)
end
|
#update!(hash) ⇒ Object
253
254
255
256
257
258
259
260
261
262
263
|
# File 'lib/zm/client/base/mailbox_object.rb', line 253
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
|
#################################################################
293
294
295
|
# File 'lib/zm/client/base/mailbox_object.rb', line 293
def uploader
@uploader ||= Upload.new(self)
end
|
58
59
60
|
# File 'lib/zm/client/base/mailbox_object.rb', line 58
def used!
@used = mailbox_infos[:s]
end
|