Class: HabiticaClient::User::Tasks

Inherits:
ApiBase
  • Object
show all
Includes:
Enumerable, Status, Types
Defined in:
lib/habitica_client/user/tasks.rb,
lib/habitica_client/user/tasks/types.rb,
lib/habitica_client/user/tasks/status.rb

Overview

An enumerable object of all the user's tasks.

Also contains the endpoint for creating new tasks.

Defined Under Namespace

Modules: Status, Types

Instance Attribute Summary

Attributes inherited from ApiBase

#client

Instance Method Summary collapse

Methods included from Status

#completed, #uncompleted

Methods included from Types

#by_type, #dailies, #habits, #todos

Methods inherited from ApiBase

#initialize

Constructor Details

This class inherits a constructor from HabiticaClient::ApiBase

Instance Method Details

#create(attributes = {}) ⇒ Object

Create a new task (and save it to habitrpg.com)

Parameters:

  • attributes (Hash) (defaults to: {})

    a hash of attributes for the new task.



26
27
28
# File 'lib/habitica_client/user/tasks.rb', line 26

def create(attributes = {})
  Task.new(client, attributes).save
end

#each(&block) ⇒ Object

Iterate over user tasks



17
18
19
20
21
# File 'lib/habitica_client/user/tasks.rb', line 17

def each(&block)
  tasks.each do |task|
    block.call Task.parse(client, task)
  end
end