Class: Harvest::API::Tasks

Inherits:
Base
  • Object
show all
Includes:
Behavior::Crud
Defined in:
lib/harvest/api/tasks.rb

Instance Attribute Summary

Attributes inherited from Base

#credentials

Instance Method Summary collapse

Methods included from Behavior::Crud

#all, #create, #delete, #find, #update

Methods inherited from Base

api_model, #initialize

Constructor Details

This class inherits a constructor from Harvest::API::Base

Instance Method Details

#activate(task) ⇒ Harvest::Task

Activates the task. Does nothing if the task is already activated

Parameters:

Returns:



26
27
28
29
30
31
32
# File 'lib/harvest/api/tasks.rb', line 26

def activate(task)
  if !task.active?
    request(:post, credentials, "#{api_model.api_path}/#{task.to_i}/activate", :headers => {'Content-Length' => '0'})
    task.active = true
  end
  task
end