Class: Things::List

Inherits:
Reference::Base show all
Defined in:
lib/things/list.rb

Constant Summary collapse

DEFAULTS =
[:inbox, :today, :next, :scheduled, :someday, :projects, :logbook, :trash]

Instance Attribute Summary

Attributes inherited from Reference::Base

#reference

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.allObject



23
24
25
# File 'lib/things/list.rb', line 23

def all
  convert(reference.get)
end

.build(reference) ⇒ Object

build a new instance and link it to the supplied reference

Returns a object associated with a reference



30
31
32
33
34
# File 'lib/things/list.rb', line 30

def build(reference)
  todo = self.new
  todo.reference = reference
  todo
end

.convert(references) ⇒ Object

Converts a collection of reference into a collection of objects



18
19
20
21
# File 'lib/things/list.rb', line 18

def convert(references)
  references = [references] if !references.is_a?(Array)
  references.collect { |todo| build(todo) }
end

.referenceObject

Returns an Appscript Reference to the entire collection of todos



13
14
15
# File 'lib/things/list.rb', line 13

def reference
  Things::App.instance.lists
end

Instance Method Details

#todosObject



6
7
8
# File 'lib/things/list.rb', line 6

def todos
  Things::Todo.convert(reference.todos.get)
end