Class: Zm::Client::SignatureJsnsInitializer

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

Overview

class for initialize account signature

Class Method Summary collapse

Class Method Details

.create(parent, json) ⇒ Object



8
9
10
11
# File 'lib/zm/client/signature/signature_jsns_initializer.rb', line 8

def create(parent, json)
  item = Signature.new(parent)
  update(item, json)
end

.update(item, json) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/zm/client/signature/signature_jsns_initializer.rb', line 13

def update(item, json)
  item.id = json[:id]
  item.name = json[:name]

  content = json[:content].is_a?(Array) ? json[:content] : [json[:content]]

  content.compact!

  content.each do |c|
    next if c[:type].nil?

    item.txt = c[:_content] if c[:type] == ContentType::TEXT
    item.html = c[:_content] if c[:type] == ContentType::HTML
  end

  item
end