things-client 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.textile ADDED
@@ -0,0 +1,49 @@
1
+ *things-client* is a ruby-base client for API of the popular GTD app Things, available on the Mac.
2
+
3
+ h2. Requirements
4
+
5
+ To use *things-client* you need Things which is version 1.2.0 or greater.
6
+
7
+ h2. Installation
8
+
9
+ The gem is hosted on Gemcutter. To install it, use the following command:
10
+
11
+ bc. sudo gem install things-client --source http://gemcutter.org
12
+
13
+ To get the latest version, clone the gem from github and run rake install:
14
+
15
+ bc. git clone http://github.com/marcinbunsch/things-client
16
+ cd things-client
17
+ rake check_dependencies:runtime
18
+ sudo rake install
19
+
20
+ h2. Usage
21
+
22
+ Before using this gem you must require it by calling:
23
+
24
+ bc. require 'things'
25
+
26
+ From then on you can manipulate Todos, Projects, Areas, Tags, People and Lists, like this:
27
+
28
+ bc. todo = Things::Todo.create(:name => 'Take out the garbage')
29
+ todo.name = 'Take out the garbage and old boxes'
30
+ todo.save
31
+
32
+ For more information, see the wiki at "http://wiki.github.com/marcinbunsch/things-client/":http://wiki.github.com/marcinbunsch/things-client/
33
+
34
+ h2. Contribution
35
+
36
+ You're more than welcome to fork and improve this gem. Usual rules:
37
+
38
+ * Fork the project.
39
+ * Make your feature addition or bug fix.
40
+ * Add tests for it. This is important so I don't break it in a
41
+ future version unintentionally.
42
+ * Commit, do not mess with rakefile, version, or history.
43
+ (if you want to have your own version, that is fine but
44
+ bump version in a commit by itself I can ignore when I pull)
45
+ * Send me a pull request.
46
+
47
+ h2. Copyright
48
+
49
+ Copyright (c) 2010 Marcin Bunsch. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/lib/things/area.rb CHANGED
@@ -8,6 +8,12 @@ module Things
8
8
  # collection is used for findings
9
9
  collection :areas
10
10
 
11
+ class << self
12
+ def all
13
+ convert(Things::App.instance.areas.get)
14
+ end
15
+ end
16
+
11
17
  def todos
12
18
  Things::Todo.convert(reference.todos.get)
13
19
  end
data/lib/things/person.rb CHANGED
@@ -10,13 +10,16 @@ module Things
10
10
  # collection is used for findings
11
11
  collection :people
12
12
 
13
- # Find a Person in Address Book and add a teammate in Things
14
- #
15
- # Returns a Things::Person object
16
- def self.create(address_book_name)
17
- reference = Things::App.instance.add_teammate_named(address_book_name)
18
- raise 'Could not find person in Address Book' if reference == :missing_value
19
- build(reference)
13
+ class << self
14
+ # Find a Person in Address Book and add a teammate in Things
15
+ #
16
+ # Returns a Things::Person object
17
+ def self.create(address_book_name)
18
+ reference = Things::App.instance.add_teammate_named(address_book_name)
19
+ raise 'Could not find person in Address Book' if reference == :missing_value
20
+ build(reference)
21
+ end
22
+
20
23
  end
21
24
 
22
25
  def todos
@@ -30,9 +33,7 @@ module Things
30
33
  raise 'Currently Things does not support this method'
31
34
  end
32
35
 
33
- # Not supported by Things::Person
34
- #
35
- # Raises a RuntimeError when called
36
+ # Deletes a Person
36
37
  def delete
37
38
  reference.delete
38
39
  end
@@ -8,6 +8,12 @@ module Things
8
8
  # collection is used for findings
9
9
  collection :projects
10
10
 
11
+ class << self
12
+ def all
13
+ convert(Things::App.instance.projects.get)
14
+ end
15
+ end
16
+
11
17
  def todos
12
18
  Things::Todo.convert(reference.todos.get)
13
19
  end
@@ -101,6 +101,11 @@ module Things
101
101
  todo.reference = reference
102
102
  todo
103
103
  end
104
+
105
+ # Converts a collection of reference into a collection of objects
106
+ def self.convert(references)
107
+ references.to_a.collect { |todo| build(todo) }
108
+ end
104
109
 
105
110
  # find a todo by a name or id
106
111
  #
data/lib/things/tag.rb CHANGED
@@ -8,5 +8,11 @@ module Things
8
8
  # collection is used for findings
9
9
  collection :tags
10
10
 
11
+ class << self
12
+ def all
13
+ convert(Things::App.instance.tags.get)
14
+ end
15
+ end
16
+
11
17
  end
12
18
  end
data/lib/things/todo.rb CHANGED
@@ -63,11 +63,6 @@ module Things
63
63
  Things::App.instance.todos
64
64
  end
65
65
 
66
- # Converts a collection of reference into a collection of objects
67
- def convert(references)
68
- references.to_a.collect { |todo| build(todo) }
69
- end
70
-
71
66
  # these are references and should be stored somewhere else...
72
67
  Things::List::DEFAULTS.each do |list|
73
68
  class_eval <<-"eval"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: things-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Bunsch
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-23 00:00:00 +01:00
12
+ date: 2010-02-26 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,12 +40,12 @@ extensions: []
40
40
 
41
41
  extra_rdoc_files:
42
42
  - LICENSE
43
- - README.rdoc
43
+ - README.textile
44
44
  files:
45
45
  - .document
46
46
  - .gitignore
47
47
  - LICENSE
48
- - README.rdoc
48
+ - README.textile
49
49
  - Rakefile
50
50
  - VERSION
51
51
  - lib/appscript/reference.rb
data/README.rdoc DELETED
@@ -1,121 +0,0 @@
1
- = Things
2
-
3
- Things is a Ruby API for the popular GTD app Things, available on the Mac.
4
-
5
- == Installation
6
-
7
- The gem is hosted on Gemcutter. To install it, use the following command:
8
-
9
- sudo gem install things-client --source http://gemcutter.org
10
-
11
- To get the latest version, clone the gem from github and run rake install:
12
-
13
- git clone http://github.com/marcinbunsch/things-client
14
- cd things-client
15
- rake check_dependencies:runtime
16
- sudo rake install
17
-
18
- == Usage
19
-
20
- Before using this gem you must require it by calling:
21
-
22
- require 'things'
23
-
24
- === Application
25
-
26
- The Application can be accessed at all times by calling Things::App. It has a few useful methods which will be described below. If you want Things to gain focus and move to the front of the window stack, you can call the Things::App.activate method.
27
-
28
- === Todos
29
-
30
- Todos are accessed via the Things::Todo class.
31
-
32
- ==== Create
33
-
34
- If you want to create a new Todo, you simple create a new instance of the Things::Todo class, supplying the parameters:
35
-
36
- Things::Todo.new(:name => 'Take out the garbage')
37
-
38
- When you're ready to send it to Things, simply call the save method on the instance:
39
-
40
- todo = Things::Todo.new(:name => 'Take out the garbage')
41
- todo.save # the Todo will appear in the Inbox
42
-
43
- If you want to send the Todo to Things during the instantiation process, simply call create:
44
-
45
- Things::Todo.create(:name => 'Take out the garbage') # the Todo will appear in the Inbox
46
-
47
- ==== Read
48
-
49
- ===== Collections
50
-
51
- If you want to fetch a list of todos, there is a set of collections you can use.
52
-
53
- The largest one is the collection of all Todos. You fetch it by calling:
54
-
55
- Things::App.todos
56
-
57
- It will return an array of Things::Todo instances.
58
-
59
- If you only want the active (so non-finished) Todos, you can fetch a collection by calling:
60
-
61
- Things::App.todos.active
62
-
63
- It will return an array of Things::Todo instances.
64
-
65
- As the gem will grow, more methods will follow.
66
-
67
- ===== Single Todos
68
-
69
- Things::Todo has a few useful methods if you want to fetch a single Todo.
70
-
71
- The smartest is the Things::Todo.find method, which will accept either a name or an id.
72
-
73
- Things::Todo.find('Take out the garbage') # => #<Things::Todo:0x115dd84>
74
- Things::Todo.find('11111111-1111-1111-1111-111111111111') # => #<Things::Todo:0x115dd84>
75
-
76
- If you want a more targeted approach, you can use Things::Todo.find_by_name or Things::Todo.find_by_id
77
-
78
- ==== Update
79
-
80
- To update a Todo, you need to fetch it, change the desired properties and save it. The following example illustrates this:
81
-
82
- todo = Things::Todo.find('Take out the garbage') # => #<Things::Todo:0x115dd84>
83
- todo.name = 'Take out the garbage and old boxes'
84
- todo.save
85
-
86
- When you open up a Things window, you'll notice that the name has changed.
87
-
88
- ==== Delete
89
-
90
- To delete a todo, simply call the delete method. The Todo will bo moved to Trash.
91
-
92
- todo = Things::Todo.find('Take out the garbage') # => #<Things::Todo:0x115dd84>
93
- todo.delete
94
-
95
- == Roadmap
96
-
97
- Currently Todos are fully supported, which is the core functionality of Todos, but leaves a lot of room for improvement. The first step is to create a unified API for handling AppleScript objects which behave in a similar way.
98
-
99
- Planned features:
100
-
101
- * Support for Projects
102
- * Support for Areas
103
- * Support for Tags
104
- * Support for Scheduled Todos
105
-
106
- == Contribution
107
-
108
- You're more than welcome to fork and improve this gem. Usual rules:
109
-
110
- * Fork the project.
111
- * Make your feature addition or bug fix.
112
- * Add tests for it. This is important so I don't break it in a
113
- future version unintentionally.
114
- * Commit, do not mess with rakefile, version, or history.
115
- (if you want to have your own version, that is fine but
116
- bump version in a commit by itself I can ignore when I pull)
117
- * Send me a pull request.
118
-
119
- == Copyright
120
-
121
- Copyright (c) 2010 Marcin Bunsch. See LICENSE for details.