Class: Zm::Client::MtaQueueJsnsBuilder
- Inherits:
-
Object
- Object
- Zm::Client::MtaQueueJsnsBuilder
- Defined in:
- lib/zm/client/mta_queue/mta_queue_jsns_builder.rb
Overview
class for Mta Queue jsns builder
Instance Method Summary collapse
-
#initialize(item) ⇒ MtaQueueJsnsBuilder
constructor
A new instance of MtaQueueJsnsBuilder.
- #to_jsns(op, ids) ⇒ Object
- #to_list ⇒ Object
Constructor Details
#initialize(item) ⇒ MtaQueueJsnsBuilder
Returns a new instance of MtaQueueJsnsBuilder.
7 8 9 |
# File 'lib/zm/client/mta_queue/mta_queue_jsns_builder.rb', line 7 def initialize(item) @item = item end |
Instance Method Details
#to_jsns(op, ids) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/zm/client/mta_queue/mta_queue_jsns_builder.rb', line 11 def to_jsns(op, ids) soap_request = SoapElement.admin(SoapAdminConstants::MAIL_QUEUE_ACTION_REQUEST) node_server = SoapElement.create('server').add_attribute(SoapConstants::NAME, @item.server.name) soap_request.add_node(node_server) node_queue = SoapElement.create('queue') node_server.add_node(node_queue) node_action = SoapElement.create('action').add_attributes({ op: op, by: :id }).add_content(ids.join(',')) node_queue.add_node(node_action) soap_request end |
#to_list ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zm/client/mta_queue/mta_queue_jsns_builder.rb', line 23 def to_list query = { offset: @item.offset, limit: @item.limit } query[:field] = @item.fields.map { |k, v| { name: k, match: { value: v } } } unless @item.fields.empty? query.reject! { |_, v| v.nil? || v.empty? } soap_request = SoapElement.admin(SoapAdminConstants::GET_MAIL_QUEUE_REQUEST) node_server = SoapElement.create('server').add_attribute(SoapConstants::NAME, @item.server.name) soap_request.add_node(node_server) node_queue = SoapElement.create('queue').add_attributes({ name: @item.mta_queue.name, scan: 1, query: query }) node_server.add_node(node_queue) soap_request end |