Class: Cherby::Task

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

Instance Attribute Summary

Attributes inherited from BusinessObject

#dom

Instance Method Summary collapse

Methods inherited from BusinessObject

#[], #[]=, #copy_fields_from, create, #get_field_node, #initialize, #mod_s, #modified, #newer_than?, 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.



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

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

#differs_from?(task) ⇒ Boolean

Return True if this Task has important fields differing from the given Task.

Returns:

  • (Boolean)


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

def differs_from?(task)
  return true if self['Status'] != task['Status']
  return false
end

#exists?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/cherby/task.rb', line 15

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

#idObject



11
12
13
# File 'lib/cherby/task.rb', line 11

def id
  self['TaskID']
end