Class: Zm::Client::MtaQueue

Inherits:
Base::AdminObject show all
Defined in:
lib/zm/client/mta_queue/mta_queue.rb

Instance Attribute Summary collapse

Attributes inherited from Base::Object

#grantee_type, #id, #parent, #token

Instance Method Summary collapse

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!, #use_builder?

Constructor Details

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

Instance Attribute Details

#nObject (readonly) Also known as: nb_items

Returns the value of attribute n.



8
9
10
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 8

def n
  @n
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 8

def name
  @name
end

Instance Method Details

#all_instance_variable_keysObject



26
27
28
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 26

def all_instance_variable_keys
  %w[name n]
end

#delete!(ids) ⇒ Object



46
47
48
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 46

def delete!(ids)
  do_action(Zm::Client::MtaQueueAction::DELETE, ids)
end

#do_action(action_name, ids) ⇒ Object



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

def do_action(action_name, ids)
  sac.mail_queue_action(parent.name, name, action_name, ids)
end

#hold!(ids) ⇒ Object



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

def hold!(ids)
  do_action(Zm::Client::MtaQueueAction::HOLD, ids)
end

#init_from_json(json) ⇒ Object



54
55
56
57
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 54

def init_from_json(json)
  @name = json[:name]
  @n = json[:n].to_i
end

#itemsObject



30
31
32
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 30

def items
  @items ||= MtaQueueItemsCollection.new self
end

#release!(ids) ⇒ Object



42
43
44
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 42

def release!(ids)
  do_action(Zm::Client::MtaQueueAction::RELEASE, ids)
end

#requeue!(ids) ⇒ Object



50
51
52
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 50

def requeue!(ids)
  do_action(Zm::Client::MtaQueueAction::REQUEUE, ids)
end

#serverObject



12
13
14
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 12

def server
  parent
end

#to_hObject



16
17
18
19
20
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 16

def to_h
  hashmap = Hash[all_instance_variable_keys.map { |key| [key, instance_variable_get(arrow_name(key))] }]
  hashmap.delete_if { |_, v| v.nil? }
  hashmap
end

#to_sObject



22
23
24
# File 'lib/zm/client/mta_queue/mta_queue.rb', line 22

def to_s
  to_h.to_s
end