Class: Rumember::Task
Instance Attribute Summary
Attributes inherited from Abstract
#parent
Instance Method Summary
collapse
Methods inherited from Abstract
boolean_reader, #initialize, integer_reader, reader, time_reader
Methods included from Dispatcher
#dispatch, #lists, #locations
Instance Method Details
62
63
64
|
# File 'lib/rumember/task.rb', line 62
def add_tags(tags)
transaction_dispatch('tasks.addTags', 'tags' => tags)
end
|
#complete ⇒ Object
50
51
52
|
# File 'lib/rumember/task.rb', line 50
def complete
transaction_dispatch('tasks.complete')
end
|
#completed? ⇒ Boolean
12
13
14
|
# File 'lib/rumember/task.rb', line 12
def completed?
!(@attributes['task']['completed'].empty?)
end
|
#delete ⇒ Object
46
47
48
|
# File 'lib/rumember/task.rb', line 46
def delete
transaction_dispatch('tasks.delete')
end
|
#deleted? ⇒ Boolean
16
17
18
|
# File 'lib/rumember/task.rb', line 16
def deleted?
!(@attributes['task']['completed'].empty?)
end
|
#lower_priority ⇒ Object
74
75
76
|
# File 'lib/rumember/task.rb', line 74
def lower_priority
transaction_dispatch('tasks.movePriority', 'direction' => 'down')
end
|
#move_to(list) ⇒ Object
78
79
80
81
82
83
84
85
86
|
# File 'lib/rumember/task.rb', line 78
def move_to(list)
transaction_dispatch(
'tasks.moveTo',
'from_list_id' => parent.id,
'to_list_id' => list.id
).tap do
@parent = list
end
end
|
#params ⇒ Object
36
37
38
|
# File 'lib/rumember/task.rb', line 36
def params
{'taskseries_id' => taskseries_id, 'task_id' => task_id}
end
|
#postpone ⇒ Object
58
59
60
|
# File 'lib/rumember/task.rb', line 58
def postpone
transaction_dispatch('tasks.postpone')
end
|
#postponed ⇒ Object
20
21
22
|
# File 'lib/rumember/task.rb', line 20
def postponed
Integer(@attributes['task']['postponed'])
end
|
#priority ⇒ Object
24
25
26
|
# File 'lib/rumember/task.rb', line 24
def priority
@attributes['task']['priority'] == "N" ? 0 : Integer(@attributes['task']['priority'])
end
|
#raise_priority ⇒ Object
70
71
72
|
# File 'lib/rumember/task.rb', line 70
def raise_priority
transaction_dispatch('tasks.movePriority', 'direction' => 'up')
end
|
66
67
68
|
# File 'lib/rumember/task.rb', line 66
def remove_tags(tags)
transaction_dispatch('tasks.removeTags', 'tags' => tags)
end
|
#set_due_date(url) ⇒ Object
Also known as:
due_date=
100
101
102
|
# File 'lib/rumember/task.rb', line 100
def set_due_date(url)
transaction_dispatch('tasks.setDueDate', 'url' => url)
end
|
#set_location(id) ⇒ Object
Also known as:
location=
105
106
107
108
|
# File 'lib/rumember/task.rb', line 105
def set_location(id)
id = id.location_id if id.respond_to?(:location_id)
transaction_dispatch('tasks.setLocation', id)
end
|
95
96
97
|
# File 'lib/rumember/task.rb', line 95
def set_tags(tags)
transaction_dispatch('tasks.setTags', 'tags' => Array(tags).join(' '))
end
|
28
29
30
31
32
33
34
|
# File 'lib/rumember/task.rb', line 28
def tags
if @attributes['tags'].empty?
[]
else
Array(@attributes['tags']['tag'])
end
end
|
#task_id ⇒ Object
8
9
10
|
# File 'lib/rumember/task.rb', line 8
def task_id
Integer(@attributes['task']['id'])
end
|
#transaction_dispatch(*args) ⇒ Object
40
41
42
43
44
|
# File 'lib/rumember/task.rb', line 40
def transaction_dispatch(*args)
super(*args) do |response|
@attributes = response['list']['taskseries']
end
end
|
#uncomplete ⇒ Object
54
55
56
|
# File 'lib/rumember/task.rb', line 54
def uncomplete
transaction_dispatch('tasks.uncomplete')
end
|