Class: TimeCamp::Task

Inherits:
Resource show all
Defined in:
lib/ruby-timecamp/resources/task.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Resource

#attributes, #initialize, resource_name

Constructor Details

This class inherits a constructor from TimeCamp::Resource

Instance Attribute Details

#archivedObject (readonly)

Returns the value of attribute archived.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def archived
  @archived
end

#assigned_byObject (readonly)

Returns the value of attribute assigned_by.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def assigned_by
  @assigned_by
end

#billableObject (readonly)

Returns the value of attribute billable.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def billable
  @billable
end

#budget_unitObject (readonly)

Returns the value of attribute budget_unit.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def budget_unit
  @budget_unit
end

#budgetedObject (readonly)

Returns the value of attribute budgeted.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def budgeted
  @budgeted
end

#colorObject (readonly)

Returns the value of attribute color.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def color
  @color
end

#external_parent_idObject (readonly)

Returns the value of attribute external_parent_id.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def external_parent_id
  @external_parent_id
end

#external_task_idObject (readonly)

Returns the value of attribute external_task_id.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def external_task_id
  @external_task_id
end

#levelObject (readonly)

Returns the value of attribute level.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def level
  @level
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def name
  @name
end

#noteObject (readonly)

Returns the value of attribute note.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def note
  @note
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def parent_id
  @parent_id
end

#public_hashObject (readonly)

Returns the value of attribute public_hash.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def public_hash
  @public_hash
end

#root_group_idObject (readonly)

Returns the value of attribute root_group_id.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def root_group_id
  @root_group_id
end

#tagsObject (readonly)

Returns the value of attribute tags.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def tags
  @tags
end

#task_idObject (readonly)

Returns the value of attribute task_id.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def task_id
  @task_id
end

#user_access_typeObject (readonly)

Returns the value of attribute user_access_type.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def user_access_type
  @user_access_type
end

#usersObject (readonly)

Returns the value of attribute users.



3
4
5
# File 'lib/ruby-timecamp/resources/task.rb', line 3

def users
  @users
end

Class Method Details

.create(opts = {}) ⇒ Object

required :name optional :tags, :parent_id, :external_task_id, :external_parent_id,

:budgeted, :note, :archived, :billable, :budget_unit,
:user_ids (comma separated), :role


22
23
24
25
26
27
# File 'lib/ruby-timecamp/resources/task.rb', line 22

def self.create(opts={})
  data_keys = [:name, :tags, :parent_id, :external_task_id, :external_parent_id, :budgeted, :note, :archived, :billable, :budget_unit, :user_ids, :role]
  data, opts = opts.partition{ |k, v| data_keys.include?(k) }.map(&:to_h)
  response = TimeCamp::Request.post(resource_name, opts, data)
  return TaskCollection.parse(response)
end

.get(opts = {}) ⇒ Object

optional :task_id



13
14
15
16
# File 'lib/ruby-timecamp/resources/task.rb', line 13

def self.get(opts={})
  response = TimeCamp::Request.get(resource_name, opts)
  return TaskCollection.parse(response)
end

.update(opts = {}) ⇒ Object

required :task_id optional :name, :tags, :parent_id, :external_task_id,

:external_parent_id, :budgeted, :note, :archived,
:billable, :budget_unit, :user_ids (comma separated), :role


33
34
35
36
37
38
# File 'lib/ruby-timecamp/resources/task.rb', line 33

def self.update(opts={})
  data_keys = [:task_id, :name, :tags, :parent_id, :external_task_id, :external_parent_id, :budgeted, :note, :archived, :billable, :budget_unit, :user_ids, :role]
  data, opts = opts.partition{ |k, v| data_keys.include?(k) }.map(&:to_h)
  response = TimeCamp::Request.put(resource_name, opts, data)
  return TaskCollection.parse(response)
end