Class: Zm::Client::MtaQueueItemJsnsInitializer

Inherits:
Base::BaseJsnsInitializer show all
Defined in:
lib/zm/client/mta_queue_item/mta_queue_item_jsns_initializer.rb

Overview

class for initialize account

Class Method Summary collapse

Methods inherited from Base::BaseJsnsInitializer

convert_json_string_value, formatted_json, valorise

Class Method Details

.create(parent, json) ⇒ Object



8
9
10
11
12
# File 'lib/zm/client/mta_queue_item/mta_queue_item_jsns_initializer.rb', line 8

def create(parent, json)
  item = MtaQueueItem.new(parent)

  update(item, json)
end

.update(item, json) ⇒ Object



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

def update(item, json)
  item.size = json[:size]
  item.fromdomain = json[:fromdomain]
  item.id = json[:id]
  item.reason = json[:reason]
  item.time = json[:time].to_i
  item.to = json[:to] ? json[:to].split(',') : []
  item.addr = json[:addr]
  item.filter = json[:filter]
  item.host = json[:host]
  item.from = json[:from]
  item.todomain = json[:todomain] ? json[:todomain].split(',') : []
  item.received = json[:received]

  item
end