Class: Basecamp::Milestone
- Inherits:
-
Object
- Object
- Basecamp::Milestone
- Defined in:
- lib/basecamp/resources/milestone.rb
Class Method Summary collapse
-
.complete(id) ⇒ Object
Complete the milestone with the given id.
-
.create(project_id, data) ⇒ Object
Create a new milestone for the given project.
-
.create_milestones(project_id, milestones) ⇒ Object
As #create_milestone, but can create multiple milestones in a single request.
-
.delete(id) ⇒ Object
Destroys the milestone with the given id.
-
.list(project_id, find = 'all') ⇒ Object
Returns a list of all milestones for the given project, optionally filtered by whether they are completed, late, or upcoming.
-
.uncomplete(id) ⇒ Object
Uncomplete the milestone with the given id.
-
.update(id, data, move = false, move_off_weekends = false) ⇒ Object
Updates an existing milestone.
Class Method Details
.complete(id) ⇒ Object
Complete the milestone with the given id
36 37 38 |
# File 'lib/basecamp/resources/milestone.rb', line 36 def complete(id) Basecamp.record "/milestones/complete/#{id}" end |
.create(project_id, data) ⇒ Object
Create a new milestone for the given project. data
must be hash of the values to set, including title
, deadline
, responsible_party
, and notify
.
12 13 14 |
# File 'lib/basecamp/resources/milestone.rb', line 12 def create(project_id, data) create_milestones(project_id, [data]).first end |
.create_milestones(project_id, milestones) ⇒ Object
As #create_milestone, but can create multiple milestones in a single request. The milestones
parameter must be an array of milestone values as described in #create_milestone.
19 20 21 |
# File 'lib/basecamp/resources/milestone.rb', line 19 def create_milestones(project_id, milestones) Basecamp.records "milestone", "/projects/#{project_id}/milestones/create", :milestone => milestones end |
.delete(id) ⇒ Object
Destroys the milestone with the given id.
31 32 33 |
# File 'lib/basecamp/resources/milestone.rb', line 31 def delete(id) Basecamp.record "/milestones/delete/#{id}" end |
.list(project_id, find = 'all') ⇒ Object
Returns a list of all milestones for the given project, optionally filtered by whether they are completed, late, or upcoming.
5 6 7 |
# File 'lib/basecamp/resources/milestone.rb', line 5 def list(project_id, find = 'all') Basecamp.records "milestone", "/projects/#{project_id}/milestones/list", :find => find end |
.uncomplete(id) ⇒ Object
Uncomplete the milestone with the given id
41 42 43 |
# File 'lib/basecamp/resources/milestone.rb', line 41 def uncomplete(id) Basecamp.record "/milestones/uncomplete/#{id}" end |
.update(id, data, move = false, move_off_weekends = false) ⇒ Object
Updates an existing milestone.
24 25 26 27 28 |
# File 'lib/basecamp/resources/milestone.rb', line 24 def update(id, data, move = false, move_off_weekends = false) Basecamp.record "/milestones/update/#{id}", :milestone => data, :move_upcoming_milestones => move, :move_upcoming_milestones_off_weekends => move_off_weekends end |