Class: CreateTask::OmniFocus

Inherits:
Helper
  • Object
show all
Defined in:
lib/create_task/omnifocus.rb

Overview

Creates a task in OmniFocus

Class Method Summary collapse

Methods inherited from Helper

#default_parsed_date, new_task, #parse_date

Class Method Details

.create(args) ⇒ Object



5
6
7
8
9
# File 'lib/create_task/omnifocus.rb', line 5

def self.create(args)
  of = app('OmniFocus')
  dd= of.default_document
  dd.make(new: :inbox_task, with_properties: processed_args(args))
end

.processed_args(args) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/create_task/omnifocus.rb', line 11

def self.processed_args(args)
  args.each{ |k,v| args.delete(k) if v.nil? }
  args[:defer_date] = args[:start_date] if args[:start_date]
  args.delete(:start_date)
  args[:due_date] = parse_date(args[:due_date]) if args[:due_date]
  args[:defer_date] = parse_date(args[:defer_date]) if args[:defer_date]
  puts args
  args
end