Class: Asana::Resources::Story
Overview
A story represents an activity associated with an object in the Asana system. Stories are generated by the system whenever users take actions such as creating or assigning tasks, or moving tasks between projects. Comments are also a form of user-generated story.
Stories are a form of history in the system, and as such they are read-only. Once generated, it is not possible to modify a story.
Instance Attribute Summary collapse
Class Method Summary
collapse
Methods inherited from Resource
inherited, #initialize, #method_missing, #refresh, #respond_to_missing?, #to_h, #to_s
#parse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Asana::Resources::Resource
Instance Attribute Details
#created_at ⇒ Object
18
19
20
|
# File 'lib/asana/resources/story.rb', line 18
def created_at
@created_at
end
|
#created_by ⇒ Object
20
21
22
|
# File 'lib/asana/resources/story.rb', line 20
def created_by
@created_by
end
|
#hearted ⇒ Object
22
23
24
|
# File 'lib/asana/resources/story.rb', line 22
def hearted
@hearted
end
|
#hearts ⇒ Object
24
25
26
|
# File 'lib/asana/resources/story.rb', line 24
def hearts
@hearts
end
|
#html_text ⇒ Object
30
31
32
|
# File 'lib/asana/resources/story.rb', line 30
def html_text
@html_text
end
|
#id ⇒ Object
16
17
18
|
# File 'lib/asana/resources/story.rb', line 16
def id
@id
end
|
#num_hearts ⇒ Object
26
27
28
|
# File 'lib/asana/resources/story.rb', line 26
def num_hearts
@num_hearts
end
|
#source ⇒ Object
34
35
36
|
# File 'lib/asana/resources/story.rb', line 34
def source
@source
end
|
#target ⇒ Object
32
33
34
|
# File 'lib/asana/resources/story.rb', line 32
def target
@target
end
|
#text ⇒ Object
28
29
30
|
# File 'lib/asana/resources/story.rb', line 28
def text
@text
end
|
#type ⇒ Object
36
37
38
|
# File 'lib/asana/resources/story.rb', line 36
def type
@type
end
|
Class Method Details
.create_on_task(client, task: required("task"), text: required("text"), options: {}, **data) ⇒ Object
Adds a comment to a task. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request.
76
77
78
79
|
# File 'lib/asana/resources/story.rb', line 76
def create_on_task(client, task: required("task"), text: required("text"), options: {}, **data)
with_params = data.merge(text: text).reject { |_,v| v.nil? || Array(v).empty? }
self.new(parse(client.post("/tasks/#{task}/stories", body: with_params, options: options)).first, client: client)
end
|
.find_by_id(client, id, options: {}) ⇒ Object
Returns the full record for a single story.
49
50
51
52
|
# File 'lib/asana/resources/story.rb', line 49
def find_by_id(client, id, options: {})
self.new(parse(client.get("/stories/#{id}", options: options)).first, client: client)
end
|
.find_by_task(client, task: required("task"), per_page: 20, options: {}) ⇒ Object
Returns the compact records for all stories on the task.
60
61
62
63
|
# File 'lib/asana/resources/story.rb', line 60
def find_by_task(client, task: required("task"), per_page: 20, options: {})
params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
Collection.new(parse(client.get("/tasks/#{task}/stories", params: params, options: options)), type: self, client: client)
end
|
.plural_name ⇒ Object
Returns the plural name of the resource.
40
41
42
|
# File 'lib/asana/resources/story.rb', line 40
def plural_name
'stories'
end
|