FWIW, ensuring that you use constructors which are methods of the appropriate parent class would look something like this in applescript for Omniplan. The pattern would be analogous in Ruby.
Code:
tell application "OmniPlan"
set oProj to project of document of window 1
tell oProj
set oTopLevelTask to make new task
end tell
tell oTopLevelTask
set oSubTask to make new task
end tell
end tell