Class: TDCLI
- Inherits:
-
Thor
- Object
- Thor
- TDCLI
- Defined in:
- lib/tdcli.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ TDCLI
constructor
A new instance of TDCLI.
- #projects ⇒ Object
- #tasks ⇒ Object
- #update ⇒ Object
- #user ⇒ Object
Constructor Details
Instance Method Details
#projects ⇒ Object
39 40 41 42 43 44 |
# 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 ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/tdcli.rb', line 14 def tasks items = @cache.get('Items') items.each do |item| puts "- #{item['content']}" end end |
#update ⇒ Object
31 32 33 34 35 36 |
# File 'lib/tdcli.rb', line 31 def update resource_types = ["all"] data = @todoistClient.sync(resource_types) @cache.set(data) @cache.save() end |
#user ⇒ Object
23 24 25 26 27 28 |
# File 'lib/tdcli.rb', line 23 def user user = @cache.get('User') user.each do |key, value| puts "#{key}: #{value}" end end |