Class: CommitTracker::Task
- Inherits:
-
Object
- Object
- CommitTracker::Task
- Defined in:
- lib/commit_tracker/task.rb
Overview
CommitTracker::Task
Abstract class for task
Instance Method Summary collapse
-
#create(options = {}) ⇒ Object
create task and return task id.
-
#delete(options = {}) ⇒ Object
delete task by id or number.
-
#initialize(options = {}) ⇒ Task
constructor
Initializes the CommitTracker::Task.
Constructor Details
#initialize(options = {}) ⇒ Task
Initializes the CommitTracker::Task
-
type tracker (:type)
-
url api (:url)
-
auth login (:login)
-
password (:password)
Examples
commit = CommitTracker::Task.new(:type => 'trackstudio'
:url => 'http://ts.domain.com/TrackStudio/services/',
:login => 'user',
:password => 'qwerty')
24 25 26 27 28 29 30 31 |
# File 'lib/commit_tracker/task.rb', line 24 def initialize(={}) @type = [:type] || 'trackstudio' @commit = nil case @type when 'trackstudio' @commit = TrackStudio.new() end end |
Instance Method Details
#create(options = {}) ⇒ Object
create task and return task id
Options:
-
name task (:name)
-
short name task (:shortname)
-
assigned user (:user)
-
parent task (:parent_number)
-
description (:description)
-
priority (:priority)
-
category task (:category)
-
budget time for task in seconds (:budget_sec)
-
deadline day (:deadline_sec)
-
name custom fields (:udf_names)(array)
-
value custom fields (:udf_values)(array)
Examples
taskId = commit.create(:name => "example task 1"
:shortname => "ex1",
:user => "user_1",
:parent_number => 123,
:description => "This is example task"
:priority => "Normal",
:category => "Task",
:budget_sec => 3 * 3600,
:deadline_sec => Time.now.to_i + 5 * 86400,
:udf_names => ['one', 'two'],
:udf_values => ['test', 4] )
61 62 63 64 65 66 67 68 |
# File 'lib/commit_tracker/task.rb', line 61 def create(={}) case @type when 'trackstudio' return @commit.create_task() else raise ErrorCommitTask, "error name tracker" end end |
#delete(options = {}) ⇒ Object
delete task by id or number
Examples
commit.delete(:task_number => 1234)
commit.delete(:task_number => taskId)
76 77 78 79 80 81 82 83 |
# File 'lib/commit_tracker/task.rb', line 76 def delete(={}) case @type when 'trackstudio' return @commit.delete_task() else raise ErrorCommitTask, "error name tracker" end end |