Class: Insightly::Task

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

Instance Method Summary collapse

Methods included from TaskLinkHelper

#add_contact, #add_contact_id, #add_opportunity, #add_opportunity_id, #add_organisation, #add_organisation_id, #add_task_link, #contact_ids, #contacts, #opportunities, #opportunity_ids, #organisation_ids, #organisations, #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, date_to_insightly, #get_collection, #initialize, #load, #process, #reload, #remote_data, #remote_id, #remote_id=, #remote_id?, #remote_id_field, #to_json, #url_base

Constructor Details

This class inherits a constructor from Insightly::Base

Instance Method Details

#comment_on(body) ⇒ Object



35
36
37
38
39
# File 'lib/insightly/task.rb', line 35

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



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

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)


53
54
55
# File 'lib/insightly/task.rb', line 53

def completed?
  status == "COMPLETED"
end

#deferred?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/insightly/task.rb', line 57

def deferred?
  status == "DEFERRED"
end


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

def fix_for_link(link)
  link.task_id = self.remote_id
  link
end

#in_progress?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/insightly/task.rb', line 45

def in_progress?
  status == "IN PROGRESS"
end

#not_started?Boolean

Returns:

  • (Boolean)


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

def not_started?
  status == "NOT STARTED"
end

#waiting?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/insightly/task.rb', line 49

def waiting?
  status == "WAITING"
end