Class: Megar::Folders

Inherits:
Object
  • Object
show all
Includes:
CatalogItem
Defined in:
lib/megar/catalog/folders.rb

Overview

Collection manager for folders

Instance Attribute Summary

Attributes included from CatalogItem

#id, #key, #name, #payload, #type

Instance Method Summary collapse

Methods included from CatalogItem

#==, #[], #attributes=, #collection, #each, #find_by_type, #reset!, #resource_class

Constructor Details

#initialize(options = {}) ⇒ Folders



5
6
# File 'lib/megar/catalog/folders.rb', line 5

def initialize(options={})
end

Instance Method Details

#add(attributes) ⇒ Object

Adds an item to the local cached collection given attributes hash.



9
10
11
# File 'lib/megar/catalog/folders.rb', line 9

def add(attributes)
  collection << Megar::Folder.new(attributes)
end

#inboxObject

Returns the inbox folder



19
20
21
# File 'lib/megar/catalog/folders.rb', line 19

def inbox
  @inbox ||= find_by_type(3)
end

#rootObject

Returns the root (cloud drive) folder



14
15
16
# File 'lib/megar/catalog/folders.rb', line 14

def root
  @root ||= find_by_type(2)
end

#trashObject

Returns the trash folder



24
25
26
# File 'lib/megar/catalog/folders.rb', line 24

def trash
  @trash ||= find_by_type(4)
end