Class: Zm::Client::MessagesCollection
- Inherits:
-
Base::AccountSearchObjectsCollection
- Object
- Base::ObjectsCollection
- Base::AccountObjectsCollection
- Base::AccountSearchObjectsCollection
- Zm::Client::MessagesCollection
- Defined in:
- lib/zm/client/message/messages_collection.rb
Overview
Collection Messages
Constant Summary
Constants inherited from Base::ObjectsCollection
Base::ObjectsCollection::METHODS_MISSING_LIST
Instance Attribute Summary
Attributes inherited from Base::AccountSearchObjectsCollection
Attributes inherited from Base::ObjectsCollection
Instance Method Summary collapse
- #delete_all(ids) ⇒ Object
- #find_each(offset: 0, limit: 500, &block) ⇒ Object
-
#initialize(parent) ⇒ MessagesCollection
constructor
A new instance of MessagesCollection.
Methods inherited from Base::AccountSearchObjectsCollection
#end_at, #find, #folder_ids, #folders, #ids, #order, #reset, #start_at, #where
Methods inherited from Base::ObjectsCollection
#all, #all!, #find, #first, #logger, #method_missing, #new, #order, #page, #per_page, #respond_to_missing?
Methods included from Inspector
#inspect, #instance_variables_map, #to_h, #to_s
Constructor Details
#initialize(parent) ⇒ MessagesCollection
Returns a new instance of MessagesCollection.
7 8 9 10 11 12 13 |
# File 'lib/zm/client/message/messages_collection.rb', line 7 def initialize(parent) super(parent) @child_class = Message @builder_class = MessagesBuilder @type = SoapConstants::MESSAGE @sort_by = SoapConstants::DATE_DESC end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Zm::Client::Base::ObjectsCollection
Instance Method Details
#delete_all(ids) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zm/client/message/messages_collection.rb', line 26 def delete_all(ids) attrs = { op: :delete, id: ids.join(',') } attrs.delete_if { |_, v| v.nil? } soap_request = SoapElement.mail(SoapMailConstants::MSG_ACTION_REQUEST) node_action = SoapElement.create(SoapConstants::ACTION).add_attributes(attrs) soap_request.add_node(node_action) @parent.sacc.invoke(soap_request) end |
#find_each(offset: 0, limit: 500, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/zm/client/message/messages_collection.rb', line 15 def find_each(offset: 0, limit: 500, &block) @more = true @offset = offset @limit = limit while @more build_response.each { |item| block.call(item) } @offset += @limit end end |