Class: Cherby::Task

Inherits:
BusinessObject show all
Defined in:
lib/cherby/task.rb

Overview

Wrapper for Cherwell task objects.

Instance Attribute Summary

Attributes inherited from BusinessObject

#dom

Instance Method Summary collapse

Methods inherited from BusinessObject

#[], #[]=, #check_dom_format!, #copy_fields_from, create, #fields_equal?, #get_field_node, #get_or_create_field_node, #initialize, #mod_s, #modified, #newer_than?, #object_type, object_type, parse_datetime, #to_hash, #to_xml

Constructor Details

This class inherits a constructor from Cherby::BusinessObject

Instance Method Details

#add_journal_note(journal_note) ⇒ Object

Add a JournalNote to this Task. Since Tasks cannot directly have JournalNotes associated with them, this just appends the note's content to the Technician Notes field (aka 'CompletionDetails') in the Task.



20
21
22
23
24
25
# File 'lib/cherby/task.rb', line 20

def add_journal_note(journal_note)
  message = "\n============================\n" + \
    "Comment added #{journal_note.mod_s} by #{journal_note['CreatedBy']}: " + \
    journal_note['Details'].to_s + "\n\n"
  self['CompletionDetails'] = self['CompletionDetails'] + message
end

#exists?Boolean

Return true if this task exists in Cherwell.

Returns:

  • (Boolean)


13
14
15
# File 'lib/cherby/task.rb', line 13

def exists?
  return !id.to_s.empty?
end

#idObject

Return this task's public ID.



8
9
10
# File 'lib/cherby/task.rb', line 8

def id
  self['TaskID']
end