class AcunoteTask

API for accessing Acunote tasks.

Public Class Methods

acu_conn() click to toggle source
# File lib/acunote_task.rb, line 5
def self.acu_conn
  AcunoteConnection.instance
end
mark_complete(proj_id, task_id) click to toggle source

This assumes that the task is current in the not started state. If it is in any other state, this will not work. TODO: Update this to identify the current status of the task and move it from any status to completed.

# File lib/acunote_task.rb, line 15
def self.mark_complete(proj_id, task_id)
  task_page = acu_conn.get_page(url(proj_id,task_id))
  if task_page.root.to_s =~ /FORM_AUTH_TOKEN = '(.*=)';/
    form_auth_token = $1
    acu_conn.mech.post("#{acu_conn.home_url}/issues/update", {'number'=>task_id,'field'=>'status','view'=>'task_details','value'=>'Completed','old_value'=>'Not Started','authenticity_token'=>form_auth_token,'project_id'=>proj_id,'_method'=>'post'})
    true
  else
    nil
  end
end
url(proj_id, task_id) click to toggle source
# File lib/acunote_task.rb, line 9
def self.url(proj_id, task_id)
  "#{acu_conn.home_url}/projects/#{proj_id}/tasks/#{task_id}"
end