Class: Asana::Resources::ProjectStatus
- Defined in:
- lib/asana/resources/project_status.rb
Overview
A _project status_ is an update on the progress of a particular project, and is sent out to all project followers when created. These updates include both text describing the update and a color code intended to represent the overall state of the project: “green” for projects that are on track, “yellow” for projects at risk, and “red” for projects that are behind.
Project statuses can be created and deleted, but not modified.
Instance Attribute Summary collapse
- #color ⇒ Object readonly
- #created_at ⇒ Object readonly
- #created_by ⇒ Object readonly
- #gid ⇒ Object readonly
- #html_text ⇒ Object readonly
- #id ⇒ Object readonly
- #resource_type ⇒ Object readonly
- #text ⇒ Object readonly
- #title ⇒ Object readonly
Class Method Summary collapse
-
.create_in_project(client, project: required("project"), text: required("text"), color: required("color"), options: {}, **data) ⇒ Object
(also: create)
Creates a new status update on the project.
-
.find_by_id(client, id, options: {}) ⇒ Object
Returns the complete record for a single status update.
-
.find_by_project(client, project: required("project"), per_page: 20, options: {}) ⇒ Object
Returns the compact project status update records for all updates on the project.
-
.plural_name ⇒ Object
Returns the plural name of the resource.
Instance Method Summary collapse
-
#delete ⇒ Object
Deletes a specific, existing project status update.
Methods inherited from Resource
inherited, #initialize, #method_missing, #refresh, #respond_to_missing?, #to_h, #to_s
Methods included from ResponseHelper
Constructor Details
This class inherits a constructor from Asana::Resources::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Asana::Resources::Resource
Instance Attribute Details
#color ⇒ Object (readonly)
27 28 29 |
# File 'lib/asana/resources/project_status.rb', line 27 def color @color end |
#created_at ⇒ Object (readonly)
31 32 33 |
# File 'lib/asana/resources/project_status.rb', line 31 def created_at @created_at end |
#created_by ⇒ Object (readonly)
29 30 31 |
# File 'lib/asana/resources/project_status.rb', line 29 def created_by @created_by end |
#gid ⇒ Object (readonly)
17 18 19 |
# File 'lib/asana/resources/project_status.rb', line 17 def gid @gid end |
#html_text ⇒ Object (readonly)
25 26 27 |
# File 'lib/asana/resources/project_status.rb', line 25 def html_text @html_text end |
#id ⇒ Object (readonly)
15 16 17 |
# File 'lib/asana/resources/project_status.rb', line 15 def id @id end |
#resource_type ⇒ Object (readonly)
19 20 21 |
# File 'lib/asana/resources/project_status.rb', line 19 def resource_type @resource_type end |
#text ⇒ Object (readonly)
23 24 25 |
# File 'lib/asana/resources/project_status.rb', line 23 def text @text end |
#title ⇒ Object (readonly)
21 22 23 |
# File 'lib/asana/resources/project_status.rb', line 21 def title @title end |
Class Method Details
.create_in_project(client, project: required("project"), text: required("text"), color: required("color"), options: {}, **data) ⇒ Object Also known as: create
Creates a new status update on the project.
50 51 52 53 |
# File 'lib/asana/resources/project_status.rb', line 50 def create_in_project(client, project: required("project"), text: required("text"), color: required("color"), options: {}, **data) with_params = data.merge(text: text, color: color).reject { |_,v| v.nil? || Array(v).empty? } Resource.new(parse(client.post("/projects/#{project}/project_statuses", body: with_params, options: )).first, client: client) end |
.find_by_id(client, id, options: {}) ⇒ Object
Returns the complete record for a single status update.
70 71 72 73 |
# File 'lib/asana/resources/project_status.rb', line 70 def find_by_id(client, id, options: {}) self.new(parse(client.get("/project_statuses/#{id}", options: )).first, client: client) end |
.find_by_project(client, project: required("project"), per_page: 20, options: {}) ⇒ Object
Returns the compact project status update records for all updates on the project.
61 62 63 64 |
# File 'lib/asana/resources/project_status.rb', line 61 def find_by_project(client, project: required("project"), per_page: 20, options: {}) params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? } Collection.new(parse(client.get("/projects/#{project}/project_statuses", params: params, options: )), type: Resource, client: client) end |
.plural_name ⇒ Object
Returns the plural name of the resource.
35 36 37 |
# File 'lib/asana/resources/project_status.rb', line 35 def plural_name 'project_statuses' end |
Instance Method Details
#delete ⇒ Object
Deletes a specific, existing project status update.
79 80 81 82 |
# File 'lib/asana/resources/project_status.rb', line 79 def delete() client.delete("/project_statuses/#{gid}") && true end |