Class: Zm::Client::FoldersCollection

Inherits:
Base::ObjectsCollection show all
Defined in:
lib/zm/client/folder/folders_collection.rb

Overview

collection of folders

Constant Summary collapse

METHODS_MISSING_LIST =
%i[select each map length].to_set.freeze

Instance Attribute Summary collapse

Attributes inherited from Base::ObjectsCollection

#parent

Instance Method Summary collapse

Methods inherited from Base::ObjectsCollection

#attrs, #build_from_entry, #count, #find, #first, #method_missing, #order, #page, #per_page, #respond_to_missing?

Constructor Details

#initialize(parent) ⇒ FoldersCollection

Returns a new instance of FoldersCollection.



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

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

#rootObject (readonly)

Returns the value of attribute root.



9
10
11
# File 'lib/zm/client/folder/folders_collection.rb', line 9

def root
  @root
end

Instance Method Details

#allObject



35
36
37
# File 'lib/zm/client/folder/folders_collection.rb', line 35

def all
  @all || all!
end

#all!Object



39
40
41
# File 'lib/zm/client/folder/folders_collection.rb', line 39

def all!
  build_response
end

#clearObject



43
44
45
46
47
# File 'lib/zm/client/folder/folders_collection.rb', line 43

def clear
  @all = nil
  @root = nil
  reset_query_params
end

#idsObject



30
31
32
33
# File 'lib/zm/client/folder/folders_collection.rb', line 30

def ids
  fb = FoldersBuilder.new @parent, make_query
  fb.ids
end

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

Yields:

  • (folder)


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

def new
  folder = Folder.new(@parent)
  yield(folder) if block_given?
  folder
end

#where(view: nil, tr: nil) ⇒ Object



23
24
25
26
27
28
# File 'lib/zm/client/folder/folders_collection.rb', line 23

def where(view: nil, tr: nil)
  @view = view
  @tr = tr
  @all = nil
  self
end