Class: Zm::Client::Base::AccountSearchObjectsCollection

Inherits:
AccountObjectsCollection show all
Defined in:
lib/zm/client/base/account_search_objects_collection.rb

Overview

Collection AccountSearchObjectsCollection

Constant Summary

Constants inherited from ObjectsCollection

ObjectsCollection::METHODS_MISSING_LIST

Instance Attribute Summary collapse

Attributes inherited from ObjectsCollection

#parent

Instance Method Summary collapse

Methods inherited from ObjectsCollection

#all, #all!, #first, #logger, #method_missing, #new, #page, #per_page, #respond_to_missing?

Methods included from Inspector

#inspect, #instance_variables_map, #to_h, #to_s

Constructor Details

#initialize(parent) ⇒ AccountSearchObjectsCollection

Returns a new instance of AccountSearchObjectsCollection.



10
11
12
13
14
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 10

def initialize(parent)
  super(parent)
  @more = true
  reset_query_params
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Zm::Client::Base::ObjectsCollection

Instance Attribute Details

#moreObject

Returns the value of attribute more.



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

def more
  @more
end

Instance Method Details

#end_at(end_at) ⇒ Object



31
32
33
34
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 31

def end_at(end_at)
  @end_at = end_at
  self
end

#find(id) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 16

def find(id)
  jsns = { m: { id: id, html: 1 } }

  soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST).add_attributes(jsns)
  rep = @parent.sacc.invoke(soap_request)
  entry = rep[:GetMsgResponse][:m].first

  MessageJsnsInitializer.create(@parent, entry)
end

#folder_ids(*folder_ids) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 44

def folder_ids(*folder_ids)
  folder_ids.uniq!
  return self if @folder_ids == folder_ids

  @folder_ids = folder_ids
  self
end

#folders(*folders) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 36

def folders(*folders)
  folders.select! { |folder| folder.is_a?(Zm::Client::Folder) }
  return self if folders.empty?

  @folders = folders
  folder_ids(*@folders.map(&:id))
end

#idsObject



65
66
67
68
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 65

def ids
  @resultMode = 'IDS'
  search_builder.ids
end

#order(sort_by) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 57

def order(sort_by)
  return self if @sort_by == sort_by

  @all = nil
  @sort_by = sort_by
  self
end

#resetObject



70
71
72
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 70

def reset
  reset_query_params
end

#start_at(start_at) ⇒ Object



26
27
28
29
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 26

def start_at(start_at)
  @start_at = start_at
  self
end

#where(query) ⇒ Object



52
53
54
55
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 52

def where(query)
  @query = query
  self
end