class GradesFirst::TaskAddCommand
Implementation of a Thor command for adding tasks to PivotalTracker
stories.
Public Class Methods
description()
click to toggle source
Description of the “gf task add” Thor command that will be used in the commandline help.
# File lib/gradesfirst/task_add_command.rb, line 9 def self.description 'Add a task to a PivotalTracker story.' end
Public Instance Methods
execute(description)
click to toggle source
Performs the gf task add Thor command.
# File lib/gradesfirst/task_add_command.rb, line 14 def execute(description) @story = current_story if @story @success = task_add(@story, description) end end
response()
click to toggle source
Generates the command line output response. The output of the task add command is a completion status message which may be followed by the new list of tasks if the task was added successfully.
# File lib/gradesfirst/task_add_command.rb, line 24 def response task_action_response(@story, @success) end
Private Instance Methods
story_error_message()
click to toggle source
# File lib/gradesfirst/task_add_command.rb, line 30 def story_error_message 'Tasks cannot be created for this branch.' end
task_add(story, description)
click to toggle source
# File lib/gradesfirst/task_add_command.rb, line 34 def task_add(story, description) PivotalTracker. projects[story['project_id']]. stories[story['id']]. tasks. post(description: description) end
task_error_message()
click to toggle source
# File lib/gradesfirst/task_add_command.rb, line 42 def task_error_message 'Creation of the task failed.' end
task_success_message()
click to toggle source
# File lib/gradesfirst/task_add_command.rb, line 46 def task_success_message 'Task was successfully added.' end