def save
      opts = {}
      opts['priority'] = priority if priority
      opts['date_string'] = date if date
      # if we don't have an id, then we can assume this is a new task.
      unless (task_details.has_key?('id'))
        result = self.class.create(self.content, self.project_id, opts)
      else
        result = self.class.update(self.content, self.id, opts)
      end

      self.content      = result.content
      self.project_id   = result.project_id
      self.task_details = result.task_details
      self
    end
def save
      opts = {}
      opts['priority'] = priority if priority
      opts['date_string'] = date if date
      # if we don't have an id, then we can assume this is a new task.
      unless (task_details.has_key?('id'))
        result = self.class.create(self.content, self.project_id, opts)
      else
        result = self.class.update(self.content, self.id, opts)
      end

      self.content      = result.content
      self.project_id   = result.project_id
      self.task_details = result.task_details
      self
    end
Saves the task

 Save the task, either creating a new task on the todoist service, or
 updating a previously retrieved task with new content, priority etc.