Class: Zm::Client::Identity

Inherits:
Base::Object show all
Defined in:
lib/zm/client/identity/identity.rb

Overview

class account identity

Instance Attribute Summary collapse

Attributes inherited from Base::Object

#parent, #token

Instance Method Summary collapse

Methods inherited from Base::Object

#initialize, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute

Constructor Details

This class inherits a constructor from Zm::Client::Base::Object

Instance Attribute Details

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def id
  @id
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def name
  @name
end

#zimbraPrefDefaultSignatureIdObject

Returns the value of attribute zimbraPrefDefaultSignatureId.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefDefaultSignatureId
  @zimbraPrefDefaultSignatureId
end

#zimbraPrefForwardReplySignatureIdObject

Returns the value of attribute zimbraPrefForwardReplySignatureId.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefForwardReplySignatureId
  @zimbraPrefForwardReplySignatureId
end

#zimbraPrefFromAddressObject

Returns the value of attribute zimbraPrefFromAddress.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefFromAddress
  @zimbraPrefFromAddress
end

#zimbraPrefFromAddressTypeObject

Returns the value of attribute zimbraPrefFromAddressType.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefFromAddressType
  @zimbraPrefFromAddressType
end

#zimbraPrefFromDisplayObject

Returns the value of attribute zimbraPrefFromDisplay.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefFromDisplay
  @zimbraPrefFromDisplay
end

#zimbraPrefIdentityNameObject

Returns the value of attribute zimbraPrefIdentityName.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefIdentityName
  @zimbraPrefIdentityName
end

#zimbraPrefReplyToAddressObject

Returns the value of attribute zimbraPrefReplyToAddress.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefReplyToAddress
  @zimbraPrefReplyToAddress
end

#zimbraPrefReplyToDisplayObject

Returns the value of attribute zimbraPrefReplyToDisplay.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefReplyToDisplay
  @zimbraPrefReplyToDisplay
end

#zimbraPrefReplyToEnabledObject

Returns the value of attribute zimbraPrefReplyToEnabled.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefReplyToEnabled
  @zimbraPrefReplyToEnabled
end

#zimbraPrefWhenInFoldersEnabledObject

Returns the value of attribute zimbraPrefWhenInFoldersEnabled.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefWhenInFoldersEnabled
  @zimbraPrefWhenInFoldersEnabled
end

#zimbraPrefWhenSentToAddressesObject

Returns the value of attribute zimbraPrefWhenSentToAddresses.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefWhenSentToAddresses
  @zimbraPrefWhenSentToAddresses
end

#zimbraPrefWhenSentToEnabledObject

Returns the value of attribute zimbraPrefWhenSentToEnabled.



7
8
9
# File 'lib/zm/client/identity/identity.rb', line 7

def zimbraPrefWhenSentToEnabled
  @zimbraPrefWhenSentToEnabled
end

Instance Method Details

#clone {|new_identity| ... } ⇒ Object

Yields:

  • (new_identity)


46
47
48
49
50
51
52
53
54
# File 'lib/zm/client/identity/identity.rb', line 46

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



12
13
14
15
16
# File 'lib/zm/client/identity/identity.rb', line 12

def create!
  rep = @parent.sacc.invoke(jsns_builder.to_jsns)
  IdentityJsnsInitializer.update(self, rep[:CreateIdentityResponse][:identity].first)
  @id
end

#delete!Object



39
40
41
42
43
44
# File 'lib/zm/client/identity/identity.rb', line 39

def delete!
  return if @id.nil?

  @parent.sacc.invoke(jsns_builder.to_delete)
  @id = nil
end

#modify!Object



18
19
20
21
# File 'lib/zm/client/identity/identity.rb', line 18

def modify!
  @parent.sacc.invoke(jsns_builder.to_update)
  true
end

#rename!(new_name) ⇒ Object

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/zm/client/identity/identity.rb', line 35

def rename!(new_name)
  raise NotImplementedError
end

#update!(hash) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/zm/client/identity/identity.rb', line 23

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