Class: Zm::Client::Signature
Overview
Constant Summary
collapse
- TYPE_TXT =
'text/plain'
- TYPE_HTML =
'text/html'
- INSTANCE_VARIABLE_KEYS =
i[id name txt html]
Instance Attribute Summary
Attributes inherited from Base::Object
#grantee_type, #id, #name, #parent, #token
Instance Method Summary
collapse
#soap_account_connector
#arrow_name, #clone, #convert_json_string_value, #initialize, #instance_variables_array, #instance_variables_hash, #recorded?, #save!, #to_s
Instance Method Details
#as_jsns ⇒ Object
57
58
59
|
# File 'lib/zm/client/signature/signature.rb', line 57
def as_jsns
SignatureJsnsBuilder.new(self).to_jsns
end
|
#concat ⇒ Object
14
15
16
|
# File 'lib/zm/client/signature/signature.rb', line 14
def concat
INSTANCE_VARIABLE_KEYS.map { |key| instance_variable_get(arrow_name(key)) }
end
|
#content ⇒ Object
53
54
55
|
# File 'lib/zm/client/signature/signature.rb', line 53
def content
html || txt
end
|
#create! ⇒ Object
27
28
29
30
|
# File 'lib/zm/client/signature/signature.rb', line 27
def create!
rep = @parent.sacc.create_signature(@parent.token, as_jsns)
@id = rep[:Body][:CreateSignatureResponse][:signature].first[:id]
end
|
#delete! ⇒ Object
36
37
38
|
# File 'lib/zm/client/signature/signature.rb', line 36
def delete!
@parent.sacc.delete_signature(@parent.token, id)
end
|
#html? ⇒ Boolean
45
46
47
|
# File 'lib/zm/client/signature/signature.rb', line 45
def html?
type == TYPE_HTML
end
|
#init_from_json(json) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/zm/client/signature/signature.rb', line 18
def init_from_json(json)
@id = json[:id]
@name = json[:name]
json[:content].each do |c|
@txt = c[:_content] if c[:type] == TYPE_TXT
@html = c[:_content] if c[:type] == TYPE_HTML
end if json[:content].is_a?(Array)
end
|
#modify! ⇒ Object
32
33
34
|
# File 'lib/zm/client/signature/signature.rb', line 32
def modify!
@parent.sacc.modify_signature(@parent.token, as_jsns)
end
|
#txt? ⇒ Boolean
49
50
51
|
# File 'lib/zm/client/signature/signature.rb', line 49
def txt?
type == TYPE_TXT
end
|
#type ⇒ Object
40
41
42
43
|
# File 'lib/zm/client/signature/signature.rb', line 40
def type
return TYPE_HTML unless html.nil?
TYPE_TXT
end
|