Class: Insightly::Task

Inherits:
ReadWrite show all
Includes:
TaskLinkHelper
Defined in:
lib/insightly/task.rb

Instance Method Summary collapse

Methods included from TaskLinkHelper

#add_task_link, #task_links, #task_links=

Methods inherited from ReadWrite

#post_collection, #put_collection, #save, #to_json, #update_data

Methods inherited from Base

#==, all, api_field, build, #build, #config, custom_fields, #get_collection, #initialize, #load, #process, #reload, #remote_data, #to_json, #url_base

Constructor Details

This class inherits a constructor from Insightly::Base

Instance Method Details

#comment_on(body) ⇒ Object



37
38
39
40
41
# File 'lib/insightly/task.rb', line 37

def comment_on(body)
  comment = Insightly::Comment.new.build({"BODY" => body})
  result = post_collection("#{url_base}/#{task_id}/comments", comment.remote_data.to_json)
  comment.build(result)
end

#commentsObject



29
30
31
32
33
34
35
# File 'lib/insightly/task.rb', line 29

def comments
  list = []
  get_collection("#{url_base}/#{task_id}/comments").each do |d|
    list << Insightly::Comment.build(d)
  end
  list
end

#completed?Boolean

Returns:

  • (Boolean)


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

def completed?
  status == "COMPLETED"
end

#deferred?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/insightly/task.rb', line 59

def deferred?
  status == "DEFERRED"
end


68
69
70
71
72
# File 'lib/insightly/task.rb', line 68

def fix_for_link(link)
  #This needs to auto set the org id on the item
  link.task_id = self.remote_id
  link
end

#in_progress?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/insightly/task.rb', line 47

def in_progress?
  status == "IN PROGRESS"
end

#not_started?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/insightly/task.rb', line 43

def not_started?
  status == "NOT STARTED"
end

#remote_idObject



64
65
66
# File 'lib/insightly/task.rb', line 64

def remote_id
  task_id
end

#waiting?Boolean

Returns:

  • (Boolean)


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

def waiting?
  status == "WAITING"
end