Class: Alexa::TodoistFilter::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/alexa/todoist_filter.rb

Instance Method Summary collapse

Instance Method Details

#inbox_todos(api_token, project_name) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/alexa/todoist_filter.rb', line 11

def inbox_todos(api_token, project_name)
  @api_token = api_token
  @project_name = project_name
  todoist_response = todoist_api_sync
  project_ids = project_ids(todoist_response['projects'])
  alexa_label_id = label_id(todoist_response['labels'])
  if alexa_label_id.nil?
    puts "Label 'Alexa' not found in account."
    exit 1
  end
  inbox_items = item_ids(todoist_response['items'], project_ids[:inbox], alexa_label_id)
  if inbox_items.empty?
    puts "No Alexa todos found in the inbox."
    exit 1
  end
  todoist_api_item_move(inbox_items, project_ids)
end