lib/habitica_cli/commands/add.rb in habitica_cli-0.1.0 vs lib/habitica_cli/commands/add.rb in habitica_cli-0.1.1
- old
+ new
@@ -2,13 +2,13 @@
# responsible for adding new todos, tasks, and dailies
# also for for caching the newly added todo
module Commands
def self.add(env, type, text)
validate_type(type)
- response = env.api.post('tasks', type: type, text: text)
+ response = env.api.post('tasks/user', type: type, text: text)
if response.success?
- task = cache_tasks(env, [response.body], type).first
+ task = cache_tasks(env, [response.body['data']], type).first
puts "Added #{task['text']} [#{task['cid']}]"
else
puts "Error adding #{text}: #{response.body}"
end
end