Class: Zm::Client::SignatureJsnsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/signature/signature_jsns_builder.rb

Overview

class for account signature jsns builder

Instance Method Summary collapse

Constructor Details

#initialize(signature) ⇒ SignatureJsnsBuilder

Returns a new instance of SignatureJsnsBuilder.



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

def initialize(signature)
  @signature = signature
end

Instance Method Details

#to_deleteObject



47
48
49
50
51
52
53
# File 'lib/zm/client/signature/signature_jsns_builder.rb', line 47

def to_delete
  soap_request = SoapElement.(SoapAccountConstants::DELETE_SIGNATURE_REQUEST)
  node_signature = SoapElement.create(SoapConstants::SIGNATURE)
                              .add_attribute(SoapConstants::ID, @signature.id)
  soap_request.add_node(node_signature)
  soap_request
end

#to_jsnsObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/zm/client/signature/signature_jsns_builder.rb', line 11

def to_jsns
  soap_request = SoapElement.(SoapAccountConstants::CREATE_SIGNATURE_REQUEST)
  node_signature = SoapElement.create(SoapConstants::SIGNATURE)
                              .add_attributes({ name: @signature.name })
  soap_request.add_node(node_signature)
  node_content = SoapElement.create(SoapConstants::CONTENT)
                            .add_attribute(SoapConstants::TYPE, @signature.type)
                            .add_content(@signature.content)
  node_signature.add_node(node_content)
  soap_request
end

#to_rename(new_name) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/zm/client/signature/signature_jsns_builder.rb', line 35

def to_rename(new_name)
  attrs = {
    id: @signature.id,
    name: new_name
  }

  soap_request = SoapElement.(SoapAccountConstants::MODIFY_SIGNATURE_REQUEST)
  node_signature = SoapElement.create(SoapConstants::SIGNATURE).add_attributes(attrs)
  soap_request.add_node(node_signature)
  soap_request
end

#to_updateObject



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

def to_update
  soap_request = SoapElement.(SoapAccountConstants::MODIFY_SIGNATURE_REQUEST)
  node_signature = SoapElement.create(SoapConstants::SIGNATURE)
                              .add_attributes({ name: @signature.name, id: @signature.id })
  soap_request.add_node(node_signature)
  node_content = SoapElement.create(SoapConstants::CONTENT)
                            .add_attribute(SoapConstants::TYPE, @signature.type)
                            .add_content(@signature.content)
  node_signature.add_node(node_content)
  soap_request
end