class TDCLI

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/tdcli.rb, line 7
def initialize(*args)
    super
    @todoistClient = TdCLI::Client.new
    @cache = TdCLI::Cache.new
end

Public Instance Methods

projects() click to toggle source
# File lib/tdcli.rb, line 39
def projects
    projects = @cache.get('Projects').sort_by {|hsh| hsh['item_order']}
    projects.each do |project|
        puts ' ' *(project['indent']-1) + "#{project['name']}"
    end
end
tasks() click to toggle source
# File lib/tdcli.rb, line 14
def tasks
    items = @cache.get('Items')
    items.each do |item|
        puts "- #{item['content']}"
    end

end
update() click to toggle source
# File lib/tdcli.rb, line 31
def update
    resource_types = ["all"]
    data = @todoistClient.sync(resource_types)
    @cache.set(data)
    @cache.save()
end
user() click to toggle source
# File lib/tdcli.rb, line 23
def user
    user = @cache.get('User')
    user.each do |key, value|
        puts "#{key}: #{value}"
    end
end