Skip to content
marcinbunsch edited this page Sep 14, 2010 · 1 revision

Persons are accessed via the Things::Person class.

Collections

Currently there are no options for fetching a collection of people

Create

Opposed to other classes, Person are created in only one way. You need to call the #create method on the Things::Person class and supply the name of that Person in the Mac OS X Address Book. Only people present in the Address Book may be added to Things:

Things::Person.create('James') # the Person will appear in the People list

Read

Things::Person has a few useful methods if you want to fetch a single Person.

The smartest is the Things::Person.find method, which will accept either a name or an id.

Things::Person.find('James') # => #<Things::Person:0x115dd84>
Things::Person.find('11111111-1111-1111-1111-111111111111') # => #<Things::Person:0x115dd84>

If you want a more targeted approach, you can use Things::Person.find_by_name or Things::Person.find_by_id

Update

Because of the limitations in the Things API, you cannot edit a Person

Delete

To delete a Person, simply call the delete method. The Person will be removed from Things.

person = Things::Person.find('James') # => #<Things::Person:0x115dd84>
person.delete

Clone this wiki locally