Sha256: 62b0296fbcd7f6ae8bfcb77440b9782bf7a060065bc6b4b14cab499e006b9c96

Contents?: true

Size: 418 Bytes

Versions: 5

Compression:

Stored size: 418 Bytes

Contents

module HabiticaCli
  # Responsible for completing tasks
  module Commands
    def self.do(env, cache_ids)
      items = cache_ids.map { |id| env.cache.get(id) }
      items.each do |item|
        response = env.api.post("tasks/#{item['id']}/score/up")
        if response.success?
          puts "Completed: #{item['text']}"
        else
          puts "Error #{response.body}"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
habitica_cli-1.0.2 lib/habitica_cli/commands/do.rb
habitica_cli-1.0.1 lib/habitica_cli/commands/do.rb
habitica_cli-1.0.0 lib/habitica_cli/commands/do.rb
habitica_cli-0.1.1 lib/habitica_cli/commands/do.rb
habitica_cli-0.1.0 lib/habitica_cli/commands/do.rb