Class: Zm::Client::Identity
Overview
Constant Summary
collapse
- INSTANCE_VARIABLE_KEYS =
i[id name zimbraPrefIdentityName zimbraPrefFromDisplay zimbraPrefFromAddress
zimbraPrefFromAddressType zimbraPrefReplyToEnabled zimbraPrefReplyToDisplay zimbraPrefReplyToAddress
zimbraPrefDefaultSignatureId zimbraPrefForwardReplySignatureId zimbraPrefWhenSentToEnabled
zimbraPrefWhenInFoldersEnabled zimbraPrefWhenSentToAddresses].freeze
- ATTRS_WRITE =
i[zimbraPrefIdentityName zimbraPrefFromDisplay zimbraPrefFromAddress
zimbraPrefFromAddressType zimbraPrefReplyToEnabled zimbraPrefReplyToDisplay zimbraPrefReplyToAddress
zimbraPrefDefaultSignatureId zimbraPrefForwardReplySignatureId zimbraPrefWhenSentToEnabled
zimbraPrefWhenInFoldersEnabled zimbraPrefWhenSentToAddresses].freeze
Instance Attribute Summary
Attributes inherited from Base::Object
#grantee_type, #id, #name, #parent, #token
Instance Method Summary
collapse
#concat, #soap_account_connector, #to_h
#arrow_name, #concat, #convert_json_string_value, #disable_builder, #enable_builder, #initialize, #instance_variables_array, #instance_variables_hash, #logger, #recorded?, #save!, #to_s, #use_builder?
Instance Method Details
#all_instance_variable_keys ⇒ Object
19
20
21
|
# File 'lib/zm/client/identity/identity.rb', line 19
def all_instance_variable_keys
INSTANCE_VARIABLE_KEYS
end
|
#clone {|new_identity| ... } ⇒ Object
64
65
66
67
68
69
70
71
72
|
# File 'lib/zm/client/identity/identity.rb', line 64
def clone
new_identity = super do |obj|
i[@zimbraPrefDefaultSignatureId @zimbraPrefForwardReplySignatureId].each do |arrow_key|
obj.remove_instance_variable(arrow_key) if obj.instance_variable_get(arrow_key)
end
end
yield(new_identity) if block_given?
new_identity
end
|
#create! ⇒ Object
34
35
36
37
|
# File 'lib/zm/client/identity/identity.rb', line 34
def create!
rep = @parent.sacc.create_identity(@parent.token, name, Hash[instance_variables_array(ATTRS_WRITE)])
init_from_json(rep[:Body][:CreateIdentityResponse][:identity].first)
end
|
#delete! ⇒ Object
57
58
59
60
|
# File 'lib/zm/client/identity/identity.rb', line 57
def delete!
@parent.sacc.delete_identity(@parent.token, @id)
super
end
|
#init_from_json(json) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/zm/client/identity/identity.rb', line 23
def init_from_json(json)
@id = json[:id]
@name = json[:name]
all_instance_variable_keys.each do |key|
value = json[:_attrs][key]
next if value.nil?
instance_variable_set(arrow_name(key), value)
end
end
|
#modify! ⇒ Object
53
54
55
|
# File 'lib/zm/client/identity/identity.rb', line 53
def modify!
@parent.sacc.modify_identity(@parent.token, id, instance_variables_array(ATTRS_WRITE))
end
|
#rename!(new_name) ⇒ Object
62
|
# File 'lib/zm/client/identity/identity.rb', line 62
def rename!(new_name); end
|
#update!(hash) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/zm/client/identity/identity.rb', line 39
def update!(hash)
@parent.sacc.modify_identity(@parent.token, id, hash)
hash.each do |k, v|
arrow_attr_sym = "@#{k}".to_sym
if v.respond_to?(:empty?) && v.empty?
remove_instance_variable(arrow_attr_sym) if instance_variable_get(arrow_attr_sym)
else
instance_variable_set(arrow_attr_sym, v)
end
end
end
|