Class: Harvest::TaskAssignment

Inherits:
Hashie::Mash
  • Object
show all
Includes:
Model
Defined in:
lib/harvest/task_assignment.rb

Instance Method Summary collapse

Methods included from Model

included

Constructor Details

#initialize(args = {}, _ = nil) ⇒ TaskAssignment

Returns a new instance of TaskAssignment



5
6
7
8
9
10
# File 'lib/harvest/task_assignment.rb', line 5

def initialize(args = {}, _ = nil)
  args = args.to_hash.stringify_keys
  self.task    = args.delete("task") if args["task"]
  self.project = args.delete("project") if args["project"]
  super
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/harvest/task_assignment.rb', line 20

def active?
  !deactivated
end

#project=(project) ⇒ Object



16
17
18
# File 'lib/harvest/task_assignment.rb', line 16

def project=(project)
  self["project_id"] = project.to_i
end

#task=(task) ⇒ Object



12
13
14
# File 'lib/harvest/task_assignment.rb', line 12

def task=(task)
  self["task_id"] = task.to_i
end

#task_as_jsonObject



24
25
26
# File 'lib/harvest/task_assignment.rb', line 24

def task_as_json
  {"task" => {"id" => task_id}}
end