Module: Toggl::Api::Project

Included in:
Base
Defined in:
lib/toggl_api/api/project.rb

Instance Method Summary collapse

Instance Method Details

#create_project(name, wid, options = {}) ⇒ Object

name: The name of the project (string, required, unique for client and workspace)

*wid*:            workspace ID, where the project will be saved (integer, required)
 cid:             client ID(integer, not required)
 active:          whether the project is archived or not (boolean, by default true)
 is_private:      whether project is accessible for only project users or for all workspace users (boolean, default true)
 template:        whether the project can be used as a template (boolean, not required)
 template_id:     id of the template project used on current project's creation
 billable:        whether the project is billable or not (boolean, default true, available only for pro workspaces)
 auto_estimates:  whether the esitamated hours is calculated based on task esimations or is fixed manually(boolean, default false, not required, premium functionality)
 estimated_hours: if auto_estimates is true then the sum of task estimations is returned, otherwise user inserted hours (integer, not required, premium functionality)
 at:              timestamp that is sent in the response for PUT, indicates the time task was last updated


17
18
19
# File 'lib/toggl_api/api/project.rb', line 17

def create_project(name, wid, options={})
  post "/projects", {"project" =>{"name"=>name,"wid"=>wid}.merge(options)}
end

#delete_project(pid) ⇒ Object Also known as: bulk_delete_projects



37
38
39
40
# File 'lib/toggl_api/api/project.rb', line 37

def delete_project(pid)
  pid = pid.join(',') if pid.is_a?(Array)
  delete "/projects/#{pid}"
end

#get_project(pid) ⇒ Object Also known as: project



26
27
28
# File 'lib/toggl_api/api/project.rb', line 26

def get_project(pid)
  get "/projects/#{pid}"
end

#get_project_users(pid) ⇒ Object Also known as: project_users



32
33
34
# File 'lib/toggl_api/api/project.rb', line 32

def get_project_users(pid)
  get "/projects/#{pid}/project_users"
end

#update_project(pid, option) ⇒ Object



21
22
23
24
# File 'lib/toggl_api/api/project.rb', line 21

def update_project(pid, option)
  options = Hashie::Mash.new options
  put "/projects/#{pid}", (options.key?(:project) ? options : {:project => options})
end