Module: Teamlab::ProjectsMilestones

Included in:
Project
Defined in:
lib/teamlab/modules/projects/projects_milestones.rb

Overview

Module for projects milestones methods

Instance Method Summary collapse

Instance Method Details

#add_milestone(project_id, title, deadline, responsible_id, options = {}) ⇒ Hash

Adds a new milestone using the parameters (project ID, milestone title, deadline, etc) specified in the request

Parameters:

  • project_id (Symbol, String)

    Project ID

  • title (String)

    Milestone title

  • deadline (String)

    Milestone deadline

  • responsible_id (String)

    Milestone responsible

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

    options to create a Milestone with

  • isKey (Hash)

    a customizable set of options

  • isNotify (Hash)

    a customizable set of options

  • description (Hash)

    a customizable set of options

  • notifyResponsible (Hash)

    a customizable set of options

Returns:

  • (Hash)

    Added milestone



60
61
62
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 60

def add_milestone(project_id, title, deadline, responsible_id, options = {})
  @request.post([project_id.to_s, 'milestone'], { title: title, deadline: deadline, responsible: responsible_id }.merge(options))
end

#delete_milestone(id) ⇒ Object



72
73
74
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 72

def delete_milestone(id)
  @request.delete(['milestone', id.to_s])
end

#delete_milestones(ids) ⇒ Array

Deletes the milestones with the IDs specified in the request

Parameters:

  • ids (Array)

    Milestone IDs

Returns:

  • (Array)

    Deleted milestones



79
80
81
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 79

def delete_milestones(ids)
  @request.delete(['milestone'], { ids: ids })
end

#get_milestone(id) ⇒ Object



14
15
16
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 14

def get_milestone(id)
  @request.get(['milestone', id.to_s])
end

#get_milestone_tasks(id) ⇒ Object



22
23
24
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 22

def get_milestone_tasks(id)
  @request.get(['milestone', id.to_s, 'task'])
end

#get_milestones_by_filter(options = {}) ⇒ Object



18
19
20
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 18

def get_milestones_by_filter(options = {})
  @request.get(%w[milestone filter], options)
end

#get_milestones_by_full_date(year, month, day) ⇒ Object



30
31
32
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 30

def get_milestones_by_full_date(year, month, day)
  @request.get(['milestone', year.to_s, month.to_s, day.to_s])
end

#get_milestones_by_month(year, month) ⇒ Object



26
27
28
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 26

def get_milestones_by_month(year, month)
  @request.get(['milestone', year.to_s, month.to_s])
end

#get_overdue_milestonesObject



10
11
12
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 10

def get_overdue_milestones
  @request.get(%w[milestone late])
end

#get_upcoming_milestonesObject



6
7
8
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 6

def get_upcoming_milestones
  @request.get(%w[milestone])
end

#milestones_by_project_id(project_id) ⇒ Array

Returns a list of all the milestones within a project with the ID specified in the request

Parameters:

  • project_id (Symbol, String)

    Project ID

Returns:

  • (Array)

    List of milestones



37
38
39
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 37

def milestones_by_project_id(project_id)
  @request.get([project_id.to_s, 'milestone'])
end

#milestones_by_project_id_and_status(project_id, status) ⇒ Array

Returns a list of all the milestones within a project with the ID and status specified in the request

Parameters:

  • project_id (Symbol, String)

    Project ID

  • status (Symbol, String)

    Milestone status

Returns:

  • (Array)

    List of milestones



45
46
47
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 45

def milestones_by_project_id_and_status(project_id, status)
  @request.get([project_id.to_s, 'milestone', status.to_s])
end

#update_milestone(id, title, deadline, options = {}) ⇒ Object



64
65
66
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 64

def update_milestone(id, title, deadline, options = {})
  @request.put(['milestone', id.to_s], { title: title, deadline: deadline }.merge(options))
end

#update_milestone_status(id, status) ⇒ Object



68
69
70
# File 'lib/teamlab/modules/projects/projects_milestones.rb', line 68

def update_milestone_status(id, status)
  @request.put(['milestone', id.to_s, 'status'], status: status)
end