Class: Zm::Client::DocumentsCollection

Inherits:
Base::ObjectsCollection show all
Defined in:
lib/zm/client/document/documents_collection.rb

Overview

collection of documents

Constant Summary collapse

DEFAULT_QUERY =
'in:briefcase'

Constants inherited from Base::ObjectsCollection

Base::ObjectsCollection::METHODS_MISSING_LIST

Instance Attribute Summary collapse

Attributes inherited from Base::ObjectsCollection

#parent

Instance Method Summary collapse

Methods inherited from Base::ObjectsCollection

#all, #all!, #build_from_entry, #find, #first, #logger, #method_missing, #order, #page, #per_page, #respond_to_missing?

Constructor Details

#initialize(parent) ⇒ DocumentsCollection

Returns a new instance of DocumentsCollection.



11
12
13
14
15
# File 'lib/zm/client/document/documents_collection.rb', line 11

def initialize(parent)
  @parent = 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.



9
10
11
# File 'lib/zm/client/document/documents_collection.rb', line 9

def more
  @more
end

Instance Method Details

#end_at(end_at) ⇒ Object



28
29
30
31
# File 'lib/zm/client/document/documents_collection.rb', line 28

def end_at(end_at)
  @end_at = end_at
  self
end

#folder_ids(folder_ids) ⇒ Object



39
40
41
42
# File 'lib/zm/client/document/documents_collection.rb', line 39

def folder_ids(folder_ids)
  @folder_ids = folder_ids
  self
end

#folders(folders) ⇒ Object



33
34
35
36
37
# File 'lib/zm/client/document/documents_collection.rb', line 33

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

#idsObject



49
50
51
52
# File 'lib/zm/client/document/documents_collection.rb', line 49

def ids
  @options = { resultMode: 1 }
  search_builder.ids
end

#new {|document| ... } ⇒ Object

Yields:

  • (document)


17
18
19
20
21
# File 'lib/zm/client/document/documents_collection.rb', line 17

def new
  document = Document.new(@parent)
  yield(document) if block_given?
  document
end

#start_at(start_at) ⇒ Object



23
24
25
26
# File 'lib/zm/client/document/documents_collection.rb', line 23

def start_at(start_at)
  @start_at = start_at
  self
end

#where(query) ⇒ Object



44
45
46
47
# File 'lib/zm/client/document/documents_collection.rb', line 44

def where(query)
  @query = query
  self
end