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!, #build_from_entry, #first, #logger, #method_missing, #new, #page, #per_page, #respond_to_missing?

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



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

def end_at(end_at)
  @end_at = end_at
  self
end

#find(id) ⇒ Object



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

def find(id)
  rep = @parent.sacc.get_msg(@parent.token, id, { html: 1 })
  entry = rep[:Body][:GetMsgResponse][:m].first

  msg = @child_class.new(@parent)
  msg.init_from_json(entry)
  msg
end

#folder_ids(folder_ids) ⇒ Object



41
42
43
44
# File 'lib/zm/client/base/account_search_objects_collection.rb', line 41

def folder_ids(folder_ids)
  @folder_ids = folder_ids
  self
end

#folders(folders) ⇒ Object



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

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

#idsObject



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

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

#order(sort_by) ⇒ Object



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

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

  @all = nil
  @sort_by = sort_by
  self
end

#resetObject



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

def reset
  reset_query_params
end

#start_at(start_at) ⇒ Object



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

def start_at(start_at)
  @start_at = start_at
  self
end

#where(query) ⇒ Object



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

def where(query)
  @query = query
  self
end