Class: Zm::Client::Resource
Overview
objectClass: zimbraCalendarResource
Instance Attribute Summary collapse
Attributes inherited from Base::Object
#grantee_type, #id, #name, #parent, #token
Instance Method Summary
collapse
#init_from_json, #soap_account_connector, #soap_admin_connector, #to_h
#arrow_name, #clone, #concat, #convert_json_string_value, #disable_builder, #enable_builder, #init_from_json, #instance_variables_array, #instance_variables_hash, #logger, #recorded?, #save!, #to_s, #use_builder?
Constructor Details
#initialize(parent) ⇒ Resource
Returns a new instance of Resource.
11
12
13
14
15
|
# File 'lib/zm/client/resource/resource.rb', line 11
def initialize(parent)
extend(ResourceCommon)
super(parent)
@grantee_type = 'usr'.freeze
end
|
Instance Attribute Details
#home_url ⇒ Object
Returns the value of attribute home_url.
9
10
11
|
# File 'lib/zm/client/resource/resource.rb', line 9
def home_url
@home_url
end
|
#zimbraCalResAutoDeclineRecurring ⇒ Object
Returns the value of attribute zimbraCalResAutoDeclineRecurring.
9
10
11
|
# File 'lib/zm/client/resource/resource.rb', line 9
def zimbraCalResAutoDeclineRecurring
@zimbraCalResAutoDeclineRecurring
end
|
Instance Method Details
#account_login_password ⇒ Object
46
47
48
49
50
|
# File 'lib/zm/client/resource/resource.rb', line 46
def account_login_password
raise ZmError, 'password is required to login !' if password.nil?
@token = sacc.auth_password(@name, @password)
end
|
#account_login_preauth ⇒ Object
39
40
41
42
43
44
|
# File 'lib/zm/client/resource/resource.rb', line 39
def account_login_preauth
domain_key
raise ZmError, 'domain key is required to login !' if @domainkey.nil?
@token = sacc.auth_preauth(@name, @domainkey)
end
|
#admin_login ⇒ Object
52
53
54
|
# File 'lib/zm/client/resource/resource.rb', line 52
def admin_login
@token = sac.delegate_auth(@name)
end
|
#all_instance_variable_keys ⇒ Object
17
18
19
|
# File 'lib/zm/client/resource/resource.rb', line 17
def all_instance_variable_keys
ResourceCommon::ALL_ATTRS
end
|
#create! ⇒ Object
97
98
99
100
101
102
103
104
|
# File 'lib/zm/client/resource/resource.rb', line 97
def create!
rep = sac.create_resource(
@name,
@password,
instance_variables_array(attrs_write)
)
@id = rep[:Body][:CreateCalendarResourceResponse][:calresource].first[:id]
end
|
#delete! ⇒ Object
81
82
83
|
# File 'lib/zm/client/resource/resource.rb', line 81
def delete!
sac.delete_resource(@id)
end
|
#domain_key ⇒ Object
60
61
62
|
# File 'lib/zm/client/resource/resource.rb', line 60
def domain_key
@domainkey ||= @parent.domain_key(domain_name)
end
|
#domain_name ⇒ Object
56
57
58
|
# File 'lib/zm/client/resource/resource.rb', line 56
def domain_name
@name.split('@').last
end
|
#folders ⇒ Object
77
78
79
|
# File 'lib/zm/client/resource/resource.rb', line 77
def folders
@folders ||= FoldersCollection.new(self)
end
|
#infos ⇒ Object
64
65
66
|
# File 'lib/zm/client/resource/resource.rb', line 64
def infos
@infos ||= read_infos
end
|
#logged? ⇒ Boolean
27
28
29
|
# File 'lib/zm/client/resource/resource.rb', line 27
def logged?
!@token.nil?
end
|
#login ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/zm/client/resource/resource.rb', line 31
def login
if @parent.logged?
admin_login
else
account_login
end
end
|
#modify! ⇒ Object
90
91
92
93
94
95
|
# File 'lib/zm/client/resource/resource.rb', line 90
def modify!
attrs_to_modify = instance_variables_array(attrs_write)
return if attrs_to_modify.empty?
sac.modify_resource(@id, attrs_to_modify)
end
|
#read_infos ⇒ Object
68
69
70
71
72
73
74
75
|
# File 'lib/zm/client/resource/resource.rb', line 68
def read_infos
@infos = sacc.get_info(@token)[:Body][:GetInfoResponse]
@id = @infos[:id]
@used = @infos[:used]
@public_url = @infos[:publicURL]
@zimbraCOSId = @infos[:cos][:id]
@home_url = @infos[:rest]
end
|
#rename!(email) ⇒ Object
106
107
108
109
|
# File 'lib/zm/client/resource/resource.rb', line 106
def rename!(email)
sac.rename_resource(@id, email)
@name = email
end
|
#rest_account_connector ⇒ Object
Also known as:
rac
21
22
23
|
# File 'lib/zm/client/resource/resource.rb', line 21
def rest_account_connector
@rest_account_connector ||= RestAccountConnector.new
end
|
#update!(hash) ⇒ Object
85
86
87
88
|
# File 'lib/zm/client/resource/resource.rb', line 85
def update!(hash)
sac.modify_resource(@id, hash)
hash.each { |k, v| send "#{k}=", v }
end
|
#uploader ⇒ Object
111
112
113
|
# File 'lib/zm/client/resource/resource.rb', line 111
def uploader
@uploader ||= Upload.new(self)
end
|