Class: Api::V1::TicketTasksController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Api::V1::TicketTasksController
- Defined in:
- app/controllers/api/v1/ticket_tasks_controller.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
-
#ticket ⇒ Object
readonly
Returns the value of attribute ticket.
Instance Method Summary collapse
Methods inherited from ApplicationController
#after_sign_in_path_for, #api_authenticate!, #current_project, #expire_revision!, #followed_projects, #no_cache, #read_revision, #require_login, #return_or_cache_revision!, #revision, #save_current_project, #set_current_project, #unfurling?
Methods included from UrlHelper
#edit_release_path, #edit_release_url, #feature_path, #github_commit_range_url, #github_commit_url, #github_project_url, #github_url?, #goldmine_case_number_url, #link_to_project_feature, #new_release_url, #release_path, #release_url, #releases_path
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
9 10 11 |
# File 'app/controllers/api/v1/ticket_tasks_controller.rb', line 9 def project @project end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
9 10 11 |
# File 'app/controllers/api/v1/ticket_tasks_controller.rb', line 9 def task @task end |
#ticket ⇒ Object (readonly)
Returns the value of attribute ticket.
9 10 11 |
# File 'app/controllers/api/v1/ticket_tasks_controller.rb', line 9 def ticket @ticket end |
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/api/v1/ticket_tasks_controller.rb', line 20 def create task = ticket.tasks.build params.slice(:description, :effort) :create, task task.updated_by = current_user if task.save render json: present_task(task), status: :created else render json: {errors: task.errors.}, status: :unprocessable_entity end end |
#destroy ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/api/v1/ticket_tasks_controller.rb', line 44 def destroy :destroy, task task.destroy head :ok end |
#index ⇒ Object
15 16 17 18 |
# File 'app/controllers/api/v1/ticket_tasks_controller.rb', line 15 def index :read, Task render json: ticket.tasks.map { |task| present_task(task) } end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/api/v1/ticket_tasks_controller.rb', line 32 def update :update, task task.attributes = params.slice(:description, :effort) task.updated_by = current_user if task.save head :ok else render json: {errors: task.errors.}, status: :unprocessable_entity end end |