goot 0.0.11 → 0.0.12
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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/goot/cli.rb +61 -5
- data/lib/goot/google_api.rb +52 -0
- data/lib/goot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 624fa57fb1f3eb82e6b225bf187090839b168741
|
4
|
+
data.tar.gz: 33998e10ddadbb42a7a143b4424f2961f0516d0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee3b00654d6241c27d1edc2331f9defdf1518feab1c0d39aa25ea87c7c6b666213d0dc29d5f58953b3a17eeda85ae6e4df12e6f8742d61539c4ef00649a16d9d
|
7
|
+
data.tar.gz: bf11b0e243e3cdc1bdaa17d94e80a289f47671e065bf86d9dda669a385a59fd081fc1d9b0a394a27e4c87575e289ce149420a2bf083921f2768f04d75f286538
|
data/README.md
CHANGED
@@ -14,12 +14,12 @@ A command-line interface to Google Tasks das ist goot.
|
|
14
14
|
|
15
15
|
# Lists tasks in a given list (0 by default)
|
16
16
|
goot list
|
17
|
-
goot l
|
17
|
+
goot l
|
18
18
|
|
19
19
|
# Toggle a task by index
|
20
20
|
goot toggle 3
|
21
|
-
goot t 3
|
21
|
+
goot t 3
|
22
22
|
|
23
23
|
# Clear completed tasks
|
24
24
|
goot clear
|
25
|
-
goot c
|
25
|
+
goot c
|
data/lib/goot/cli.rb
CHANGED
@@ -7,7 +7,6 @@ class GoogleTasks::CLI < Thor
|
|
7
7
|
end
|
8
8
|
|
9
9
|
desc "list", "Displays available tasks for a given tasklist"
|
10
|
-
method_option :aliases => "l"
|
11
10
|
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
12
11
|
def list
|
13
12
|
tab = ' '
|
@@ -32,7 +31,6 @@ class GoogleTasks::CLI < Thor
|
|
32
31
|
end
|
33
32
|
|
34
33
|
desc "summary", "Displays all task lists and their task counts"
|
35
|
-
method_option :aliases => "s"
|
36
34
|
def summary
|
37
35
|
@api.get_lists.each.with_index do |tasklist, i|
|
38
36
|
tasks = @api.get_tasks(tasklist)
|
@@ -40,8 +38,7 @@ class GoogleTasks::CLI < Thor
|
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
43
|
-
desc "toggle", "Toggles a given task"
|
44
|
-
method_option :aliases => "t"
|
41
|
+
desc "toggle INDEX", "Toggles a given task"
|
45
42
|
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
46
43
|
def toggle(index)
|
47
44
|
tasklist = @api.get_tasklist(options[:tasklist])
|
@@ -67,7 +64,6 @@ class GoogleTasks::CLI < Thor
|
|
67
64
|
end
|
68
65
|
|
69
66
|
desc "clear", "Clears completed tasks"
|
70
|
-
method_option :aliases => "c"
|
71
67
|
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
72
68
|
def clear
|
73
69
|
tasklist = @api.get_tasklist(options[:tasklist])
|
@@ -75,4 +71,64 @@ class GoogleTasks::CLI < Thor
|
|
75
71
|
|
76
72
|
invoke :list, [], :tasklist => options[:tasklist]
|
77
73
|
end
|
74
|
+
|
75
|
+
desc "delete INDEX", "Deletes a given task"
|
76
|
+
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
77
|
+
def delete(index)
|
78
|
+
tasklist = @api.get_tasklist(options[:tasklist])
|
79
|
+
tasks = @api.get_tasks(tasklist).map(&:to_hash)
|
80
|
+
|
81
|
+
@api.delete_task(tasklist, tasks[index.to_i])
|
82
|
+
|
83
|
+
invoke :list, [], :tasklist => options[:tasklist]
|
84
|
+
end
|
85
|
+
|
86
|
+
desc "move INDEX", "Moves a given task"
|
87
|
+
method_option :after, :aliases => "-a", :type => :numeric
|
88
|
+
method_option :parent, :aliases => "-p", :type => :numeric
|
89
|
+
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
90
|
+
def move(index)
|
91
|
+
tasklist = @api.get_tasklist(options[:tasklist])
|
92
|
+
tasks = @api.get_tasks(tasklist).map(&:to_hash)
|
93
|
+
|
94
|
+
previous = tasks[options[:after].to_i] if !options[:after].nil?
|
95
|
+
parent = tasks[options[:parent].to_i] if !options[:parent].nil?
|
96
|
+
|
97
|
+
@api.move_task(tasklist, tasks[index.to_i], previous, parent)
|
98
|
+
|
99
|
+
invoke :list, [], :tasklist => options[:tasklist]
|
100
|
+
end
|
101
|
+
|
102
|
+
desc "add NAME", "Adds a task"
|
103
|
+
method_option :after, :aliases => "-a", :type => :numeric
|
104
|
+
method_option :parent, :aliases => "-p", :type => :numeric
|
105
|
+
method_option :tasklist, :aliases => "-l", :type => :numeric, :default => 0
|
106
|
+
def add(name)
|
107
|
+
tasklist = @api.get_tasklist(options[:tasklist])
|
108
|
+
tasks = @api.get_tasks(tasklist).map(&:to_hash)
|
109
|
+
task = { :title => name }
|
110
|
+
|
111
|
+
previous = tasks[options[:after].to_i] if !options[:after].nil?
|
112
|
+
parent = tasks[options[:parent].to_i] if !options[:parent].nil?
|
113
|
+
|
114
|
+
@api.insert_task(tasklist, task, previous, parent)
|
115
|
+
|
116
|
+
invoke :list, [], :tasklist => options[:tasklist]
|
117
|
+
end
|
118
|
+
|
119
|
+
desc "listadd NAME", "Adds a new tasklist"
|
120
|
+
def listadd(name)
|
121
|
+
tasklist = {:title => name}
|
122
|
+
@api.insert_tasklist(tasklist)
|
123
|
+
|
124
|
+
invoke :summary, []
|
125
|
+
end
|
126
|
+
|
127
|
+
desc "listdelete INDEX", "Deletes a tasklist"
|
128
|
+
def listdelete(index)
|
129
|
+
@api.delete_tasklist(@api.get_lists[index.to_i])
|
130
|
+
|
131
|
+
invoke :summary, []
|
132
|
+
end
|
133
|
+
|
78
134
|
end
|
data/lib/goot/google_api.rb
CHANGED
@@ -49,6 +49,22 @@ class GoogleTasks::GoogleAPI
|
|
49
49
|
).data
|
50
50
|
end
|
51
51
|
|
52
|
+
def insert_tasklist(tasklist)
|
53
|
+
@client.execute(
|
54
|
+
:api_method => @api.tasklists.insert,
|
55
|
+
:body_object => tasklist
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
def delete_tasklist(tasklist)
|
60
|
+
@client.execute(
|
61
|
+
:api_method => @api.tasklists.delete,
|
62
|
+
:parameters => {
|
63
|
+
:tasklist => tasklist.id
|
64
|
+
}
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
52
68
|
def get_tasks(tasklist)
|
53
69
|
@client.execute(
|
54
70
|
:api_method => @api.tasks.list,
|
@@ -78,4 +94,40 @@ class GoogleTasks::GoogleAPI
|
|
78
94
|
)
|
79
95
|
end
|
80
96
|
|
97
|
+
def insert_task(tasklist, task, previous, parent)
|
98
|
+
parameters = { :tasklist => tasklist.id }
|
99
|
+
parameters[:previous] = previous['id'] if !previous.nil?
|
100
|
+
parameters[:parent] = parent['id'] if !parent.nil?
|
101
|
+
|
102
|
+
@client.execute(
|
103
|
+
:api_method => @api.tasks.insert,
|
104
|
+
:parameters => parameters,
|
105
|
+
:body_object => task
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
def delete_task(tasklist, task)
|
110
|
+
@client.execute(
|
111
|
+
:api_method => @api.tasks.delete,
|
112
|
+
:parameters => {
|
113
|
+
:tasklist => tasklist.id,
|
114
|
+
:task => task['id']
|
115
|
+
}
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
def move_task(tasklist, task, previous, parent)
|
120
|
+
parameters = {
|
121
|
+
:tasklist => tasklist.id,
|
122
|
+
:task => task['id']
|
123
|
+
}
|
124
|
+
parameters[:previous] = previous['id'] if !previous.nil?
|
125
|
+
parameters[:parent] = parent['id'] if !parent.nil?
|
126
|
+
|
127
|
+
@client.execute(
|
128
|
+
:api_method => @api.tasks.move,
|
129
|
+
:parameters => parameters
|
130
|
+
)
|
131
|
+
end
|
132
|
+
|
81
133
|
end
|
data/lib/goot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Conner McDaniel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|