Class: Zm::Client::MtaQueueItem
- Inherits:
-
Base::AdminObject
- Object
- Base::Object
- Base::AdminObject
- Zm::Client::MtaQueueItem
- Defined in:
- lib/zm/client/mta_queue_item/mta_queue_item.rb
Constant Summary collapse
- INSTANCE_VARIABLE_KEYS =
%i[size fromdomain id reason time to addr filter host from todomain received]
Instance Attribute Summary collapse
-
#n ⇒ Object
readonly
Returns the value of attribute n.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Base::Object
#grantee_type, #id, #parent, #token
Instance Method Summary collapse
- #hold! ⇒ Object
- #init_from_json(json) ⇒ Object
- #mta_queue ⇒ Object
- #sent_at ⇒ Object
- #server ⇒ Object
- #to_h ⇒ Object
Methods inherited from Base::AdminObject
#soap_account_connector, #soap_admin_connector
Methods inherited from Base::Object
#arrow_name, #clone, #concat, #convert_json_string_value, #disable_builder, #enable_builder, #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
#n ⇒ Object (readonly)
Returns the value of attribute n.
6 7 8 |
# File 'lib/zm/client/mta_queue_item/mta_queue_item.rb', line 6 def n @n end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/zm/client/mta_queue_item/mta_queue_item.rb', line 6 def name @name end |
Instance Method Details
#hold! ⇒ Object
31 32 33 |
# File 'lib/zm/client/mta_queue_item/mta_queue_item.rb', line 31 def hold! sac.mail_queue_action(server.name, mta_queue.name, Zm::Client::MtaQueueAction::HOLD, @id) end |
#init_from_json(json) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/zm/client/mta_queue_item/mta_queue_item.rb', line 35 def init_from_json(json) @size = json[:size] @fromdomain = json[:fromdomain] @id = json[:id] @reason = json[:reason] @time = json[:time].to_i @to = json[:to] ? json[:to].split(',') : [] @addr = json[:addr] @filter = json[:filter] @host = json[:host] @from = json[:from] @todomain = json[:todomain] ? json[:todomain].split(',') : [] @received = json[:received] end |
#mta_queue ⇒ Object
11 12 13 |
# File 'lib/zm/client/mta_queue_item/mta_queue_item.rb', line 11 def mta_queue parent end |
#sent_at ⇒ Object
25 26 27 28 29 |
# File 'lib/zm/client/mta_queue_item/mta_queue_item.rb', line 25 def sent_at @sent_at ||= Time.at(@time / 1000) rescue StandardError => e nil end |
#server ⇒ Object
15 16 17 |
# File 'lib/zm/client/mta_queue_item/mta_queue_item.rb', line 15 def server mta_queue.parent end |
#to_h ⇒ Object
19 20 21 22 23 |
# File 'lib/zm/client/mta_queue_item/mta_queue_item.rb', line 19 def to_h hashmap = Hash[INSTANCE_VARIABLE_KEYS.map { |key| [key, instance_variable_get(arrow_name(key))] }] hashmap.delete_if { |_, v| v.nil? } hashmap end |