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



43
44
45
46
47
48
# File 'lib/zm/client/signature/signature_jsns_builder.rb', line 43

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
# 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



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/zm/client/signature/signature_jsns_builder.rb', line 31

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



21
22
23
24
25
26
27
28
29
# File 'lib/zm/client/signature/signature_jsns_builder.rb', line 21

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