class Asana::Resources::Story

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.

Attributes

created_at[R]
created_by[R]
hearted[R]
hearts[R]
html_text[R]
id[R]
num_hearts[R]
source[R]
target[R]
text[R]
type[R]

Public Class Methods

create_on_task(client, task: required("task"), text: required("text"), options: {}, **data) click to toggle source

Adds a comment to a task. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request.

Returns the full record for the new story added to the task.

task - [Id] Globally unique identifier for the task.

text - [String] The plain text of the comment to add. options - [Hash] the request I/O options. data - [Hash] the attributes to post.

# 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: {}) click to toggle source

Returns the full record for a single story.

id - [Id] Globally unique identifier for the story.

options - [Hash] the request I/O options.

# File lib/asana/resources/story.rb, line 60
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: {}) click to toggle source

Returns the compact records for all stories on the task.

task - [Id] Globally unique identifier for the task.

per_page - [Integer] the number of records to fetch per page. options - [Hash] the request I/O options.

# File lib/asana/resources/story.rb, line 50
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() click to toggle source

Returns the plural name of the resource.

# File lib/asana/resources/story.rb, line 40
def plural_name
  'stories'
end