Class: Zm::Client::IdentityJsnsBuilder

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

Overview

class for account identity jsns builder

Instance Method Summary collapse

Constructor Details

#initialize(item) ⇒ IdentityJsnsBuilder

Returns a new instance of IdentityJsnsBuilder.



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

def initialize(item)
  @item = item
end

Instance Method Details

#attrsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/zm/client/identity/identity_jsns_builder.rb', line 39

def attrs
  {
    zimbraPrefIdentityName: @item.zimbraPrefIdentityName,
    zimbraPrefFromDisplay: @item.zimbraPrefFromDisplay,
    zimbraPrefFromAddress: @item.zimbraPrefFromAddress,
    zimbraPrefFromAddressType: @item.zimbraPrefFromAddressType,
    zimbraPrefReplyToEnabled: @item.zimbraPrefReplyToEnabled,
    zimbraPrefReplyToDisplay: @item.zimbraPrefReplyToDisplay,
    zimbraPrefReplyToAddress: @item.zimbraPrefReplyToAddress,
    zimbraPrefDefaultSignatureId: @item.zimbraPrefDefaultSignatureId,
    zimbraPrefForwardReplySignatureId: @item.zimbraPrefForwardReplySignatureId,
    zimbraPrefWhenSentToEnabled: @item.zimbraPrefWhenSentToEnabled,
    zimbraPrefWhenInFoldersEnabled: @item.zimbraPrefWhenInFoldersEnabled,
    zimbraPrefWhenSentToAddresses: @item.zimbraPrefWhenSentToAddresses
  }
end

#to_deleteObject



32
33
34
35
36
37
# File 'lib/zm/client/identity/identity_jsns_builder.rb', line 32

def to_delete
  soap_request = SoapElement.(SoapAccountConstants::DELETE_IDENTITY_REQUEST)
  node_identity = SoapElement.create(SoapConstants::IDENTITY).add_attributes({ id: @item.id })
  soap_request.add_node(node_identity)
  soap_request
end

#to_jsnsObject



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

def to_jsns
  soap_request = SoapElement.(SoapAccountConstants::CREATE_IDENTITY_REQUEST)
  node_identity = SoapElement.create(SoapConstants::IDENTITY).add_attributes({ name: @item.name, _attrs: attrs })
  soap_request.add_node(node_identity)
  soap_request
end

#to_patch(hash) ⇒ Object



25
26
27
28
29
30
# File 'lib/zm/client/identity/identity_jsns_builder.rb', line 25

def to_patch(hash)
  soap_request = SoapElement.(SoapAccountConstants::MODIFY_IDENTITY_REQUEST)
  node_identity = SoapElement.create(SoapConstants::IDENTITY).add_attributes({ id: @item.id, _attrs: hash })
  soap_request.add_node(node_identity)
  soap_request
end

#to_updateObject



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

def to_update
  soap_request = SoapElement.(SoapAccountConstants::MODIFY_IDENTITY_REQUEST)
  node_identity = SoapElement.create(SoapConstants::IDENTITY).add_attributes({ id: @item.id, _attrs: attrs })
  soap_request.add_node(node_identity)
  soap_request
end