Class: TrackerApi::Resources::Story
- Includes:
- TrackerApi::Resources::Shared::Base
- Defined in:
- lib/tracker_api/resources/story.rb
Defined Under Namespace
Classes: UpdateRepresenter
Instance Method Summary collapse
-
#activity(params = {}) ⇒ Array[Activity]
Provides a list of all the activity performed on the story.
-
#add_label(label) ⇒ Object
Adds a new label to the story.
-
#comments(params = {}) ⇒ Array[Comment]
Provides a list of all the comments on the story.
-
#create_task(params) ⇒ Task
Newly created Task.
-
#label_list ⇒ String
Comma separated list of labels.
-
#owners(params = {}) ⇒ Array[Person]
Provides a list of all the owners of the story.
-
#save ⇒ Object
Save changes to an existing Story.
-
#tasks(params = {}) ⇒ Array[Task]
Provides a list of all the tasks on the story.
Methods included from TrackerApi::Resources::Shared::Base
Instance Method Details
#activity(params = {}) ⇒ Array[Activity]
Provides a list of all the activity performed on the story.
84 85 86 |
# File 'lib/tracker_api/resources/story.rb', line 84 def activity(params = {}) Endpoints::Activity.new(client).get_story(project_id, id, params) end |
#add_label(label) ⇒ Object
Adds a new label to the story.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/tracker_api/resources/story.rb', line 69 def add_label(label) new_label = if label.kind_of?(String) Label.new(name: label) else label end # Use attribute writer to get coercion and dirty tracking. self.labels = (labels ? labels.dup : []).push(new_label) end |
#comments(params = {}) ⇒ Array[Comment]
Provides a list of all the comments on the story.
92 93 94 95 96 97 98 |
# File 'lib/tracker_api/resources/story.rb', line 92 def comments(params = {}) if params.blank? && @comments.present? @comments else @comments = Endpoints::Comments.new(client).get(project_id, id, params) end end |
#create_task(params) ⇒ Task
Returns newly created Task.
126 127 128 |
# File 'lib/tracker_api/resources/story.rb', line 126 def create_task(params) Endpoints::Task.new(client).create(project_id, id, params) end |
#label_list ⇒ String
Returns Comma separated list of labels.
62 63 64 |
# File 'lib/tracker_api/resources/story.rb', line 62 def label_list @label_list ||= labels.collect(&:name).join(',') end |
#owners(params = {}) ⇒ Array[Person]
Provides a list of all the owners of the story.
116 117 118 119 120 121 122 |
# File 'lib/tracker_api/resources/story.rb', line 116 def owners(params = {}) if params.blank? && @owners.present? @owners else @owners = Endpoints::StoryOwners.new(client).get(project_id, id, params) end end |
#save ⇒ Object
Save changes to an existing Story.
131 132 133 134 135 |
# File 'lib/tracker_api/resources/story.rb', line 131 def save raise ArgumentError, 'Can not update a story with an unknown project_id.' if project_id.nil? Endpoints::Story.new(client).update(self, UpdateRepresenter.new(Story.new(self.dirty_attributes))) end |
#tasks(params = {}) ⇒ Array[Task]
Provides a list of all the tasks on the story.
104 105 106 107 108 109 110 |
# File 'lib/tracker_api/resources/story.rb', line 104 def tasks(params = {}) if params.blank? && @tasks.present? @tasks else @tasks = Endpoints::Tasks.new(client).get(project_id, id, params) end end |