Class: ConsoleRtm::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/rmilk/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, text, list_name, milk_task = nil, tags = {}) ⇒ Task

Returns a new instance of Task.



9
10
11
12
13
14
15
# File 'lib/rmilk/task.rb', line 9

def initialize(id, text, list_name, milk_task = nil, tags = {})
  @id = id
  @text = text
  @list_name = list_name
  @milk_task = milk_task
  @tags = tags
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/rmilk/task.rb', line 6

def id
  @id
end

#list_nameObject (readonly)

Returns the value of attribute list_name.



6
7
8
# File 'lib/rmilk/task.rb', line 6

def list_name
  @list_name
end

#milk_taskObject

Returns the value of attribute milk_task.



7
8
9
# File 'lib/rmilk/task.rb', line 7

def milk_task
  @milk_task
end

#tagsObject (readonly)

Returns the value of attribute tags.



6
7
8
# File 'lib/rmilk/task.rb', line 6

def tags
  @tags
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/rmilk/task.rb', line 6

def text
  @text
end

Instance Method Details

#==(obj) ⇒ Object



55
56
57
58
# File 'lib/rmilk/task.rb', line 55

def ==(obj)
  id = obj.id && text == obj.text &&
          list_name == obj.list_name && tags == obj.tags
end

#complete!Object



17
18
19
# File 'lib/rmilk/task.rb', line 17

def complete!
  @milk_task.complete!
end

#delete!Object



21
22
23
# File 'lib/rmilk/task.rb', line 21

def delete!
  @milk_task.delete!
end

#due=(due) ⇒ Object



41
42
43
# File 'lib/rmilk/task.rb', line 41

def due=(due)
  execute_milk "rtm.tasks.setDueDate", {:due => due}
end

#move_to(to_list_id) ⇒ Object



45
46
47
48
49
# File 'lib/rmilk/task.rb', line 45

def move_to(to_list_id)
  execute_milk "rtm.tasks.moveTo",
               {:from_list_id => milk_task.list_id,
                :to_list_id => to_list_id}
end

#postpone!Object



25
26
27
# File 'lib/rmilk/task.rb', line 25

def postpone!
  execute_milk "rtm.tasks.postpone"
end

#priorityObject



37
38
39
# File 'lib/rmilk/task.rb', line 37

def priority
  milk_task.priority 
end

#priority=(priority) ⇒ Object



33
34
35
# File 'lib/rmilk/task.rb', line 33

def priority=(priority)
  execute_milk "rtm.tasks.setPriority", {:priority => priority}
end

#to_sObject



51
52
53
# File 'lib/rmilk/task.rb', line 51

def to_s
  "#{@list_name}: #{@id} - #{@text}"
end

#uncomplete!Object



29
30
31
# File 'lib/rmilk/task.rb', line 29

def uncomplete!
  execute_milk "rtm.tasks.uncomplete"
end