Class: Things::Person

Inherits:
Reference::Record show all
Defined in:
lib/things/person.rb

Overview

Things::Person

People in Things cannot be created, they are fetched from Address Book

Instance Attribute Summary

Attributes inherited from Reference::Base

#reference

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Reference::Record

build, collection, convert, find, find_by_id, find_by_name, identifier, #initialize, #new?, properties

Methods included from Reference::Inheritance

#inheritable_attributes, #inherited

Constructor Details

This class inherits a constructor from Things::Reference::Record

Class Method Details

.allObject



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

def all
  convert(Things::App.instance.people.get)
end

.create(address_book_name) ⇒ Object

Find a Person in Address Book and add a teammate in Things

Returns a Things::Person object



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

def create(address_book_name)
  reference = Things::App.instance.add_teammate_named(address_book_name)
  raise 'Could not find person in Address Book' if reference == :missing_value
  build(reference)
end

Instance Method Details

#deleteObject

Deletes a Person



41
42
43
# File 'lib/things/person.rb', line 41

def delete
  reference.delete
end

#saveObject

Not supported by Things::Person

Raises a RuntimeError when called



36
37
38
# File 'lib/things/person.rb', line 36

def save
  raise 'Currently Things does not support this method'
end

#todosObject



29
30
31
# File 'lib/things/person.rb', line 29

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