Class: Zm::Client::Signature

Inherits:
Base::AccountObject show all
Includes:
Model::AttributeChangeObserver
Defined in:
lib/zm/client/signature/signature.rb

Overview

class account signature

Constant Summary collapse

TYPE_TXT =
'text/plain'
TYPE_HTML =
'text/html'
INSTANCE_VARIABLE_KEYS =
i[id name txt html]

Instance Attribute Summary collapse

Attributes inherited from Base::Object

#grantee_type, #name, #parent, #token

Instance Method Summary collapse

Methods included from Model::AttributeChangeObserver

included

Methods inherited from Base::AccountObject

#concat, #init_from_json, #rename!, #soap_account_connector, #to_h

Methods inherited from Base::Object

#arrow_name, #clone, #concat, #convert_json_string_value, #disable_builder, #enable_builder, #init_from_json, #initialize, #instance_variables_array, #instance_variables_hash, #logger, #recorded?, #save!, #to_s, #use_builder?

Constructor Details

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/zm/client/signature/signature.rb', line 14

def id
  @id
end

Instance Method Details

#all_instance_variable_keysObject



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

def all_instance_variable_keys
  INSTANCE_VARIABLE_KEYS
end

#contentObject



51
52
53
# File 'lib/zm/client/signature/signature.rb', line 51

def content
  html || txt
end

#create!Object



22
23
24
25
26
# File 'lib/zm/client/signature/signature.rb', line 22

def create!
  rep = @parent.sacc.create_signature(@parent.token, as_jsns)
  @id = rep[:Body][:CreateSignatureResponse][:signature].first[:id]
  super
end

#delete!Object



33
34
35
36
# File 'lib/zm/client/signature/signature.rb', line 33

def delete!
  @parent.sacc.delete_signature(@parent.token, jsns_builder.to_delete)
  super
end

#html?Boolean



43
44
45
# File 'lib/zm/client/signature/signature.rb', line 43

def html?
  type == TYPE_HTML
end

#modify!Object



28
29
30
31
# File 'lib/zm/client/signature/signature.rb', line 28

def modify!
  @parent.sacc.modify_signature(@parent.token, as_jsns)
  super
end

#txt?Boolean



47
48
49
# File 'lib/zm/client/signature/signature.rb', line 47

def txt?
  type == TYPE_TXT
end

#typeObject



38
39
40
41
# File 'lib/zm/client/signature/signature.rb', line 38

def type
  return TYPE_HTML unless html.nil?
  TYPE_TXT
end